+ unsigned Flags;
+ unsigned InitLabel;
+
+ /* Determine if this is a compound variable */
+ int IsCompound = IsClassStruct (Decl->Type) || IsTypeArray (Decl->Type);
+
+ /* Get the size of the variable */
+ unsigned Size = SizeOf (Decl->Type);
+
+ /* Save the current contents of the register variable on stack */
+ F_AllocLocalSpace (CurrentFunc);
+ g_save_regvars (Reg, Size);
+
+ /* Check for an optional initialization */
+ if (CurTok.Tok == TOK_ASSIGN) {
+
+ ExprDesc lval;
+
+ /* Skip the '=' */
+ NextToken ();
+
+ /* Special handling for compound types */
+ if (IsCompound) {
+
+ /* Switch to read only data */
+ g_userodata ();
+
+ /* Define a label for the initialization data */
+ InitLabel = GetLocalLabel ();
+ g_defdatalabel (InitLabel);
+
+ /* Parse the initialization generating a memory image of the
+ * data in the RODATA segment. The function does return the size
+ * of the initialization data, which may be greater than the
+ * actual size of the type, if the type is a structure with a
+ * flexible array member that has been initialized. Since we must
+ * know the size of the data in advance for register variables,
+ * we cannot allow that here.
+ */
+ if (ParseInit (Decl->Type) != Size) {
+ Error ("Cannot initialize flexible array members of storage class `register'");
+ }
+
+ /* Generate code to copy this data into the variable space */
+ g_initregister (InitLabel, Reg, Size);
+
+ } else {
+
+ /* Setup the type flags for the assignment */
+ Flags = CF_NONE;
+ if (Size == SIZEOF_CHAR) {
+ Flags |= CF_FORCECHAR;
+ }
+
+ /* Get the expression into the primary */
+ if (evalexpr (Flags, hie1, &lval) == 0) {
+ /* Constant expression. Adjust the types */
+ assignadjust (Decl->Type, &lval);
+ Flags |= CF_CONST;
+ /* Load it into the primary */
+ exprhs (Flags, 0, &lval);
+ } else {
+ /* Expression is not constant and in the primary */
+ assignadjust (Decl->Type, &lval);
+ }
+
+ /* Store the value into the variable */
+ Flags |= CF_REGVAR;
+ g_putstatic (Flags | TypeOf (Decl->Type), Reg, 0);
+
+ }
+
+ /* Mark the variable as referenced */
+ *SC |= SC_REF;