(expand_expr, case VAR_DECL): If decl wasn't laid out,
authorRichard Stallman <rms@gnu.org>
Fri, 8 Oct 1993 04:58:24 +0000 (04:58 +0000)
committerRichard Stallman <rms@gnu.org>
Fri, 8 Oct 1993 04:58:24 +0000 (04:58 +0000)
lay it out now, and fix the rtl's mode.

From-SVN: r5671

gcc/expr.c

index 5711d0cb342171691e8a3f0c37e8c67ecc92b1db..0d01325046482313aeb89863b52955e8f5d63d18 100644 (file)
@@ -3681,8 +3681,19 @@ expand_expr (exp, target, tmode, modifier)
          return CONST0_RTX (mode);
        }
 
-    case FUNCTION_DECL:
     case VAR_DECL:
+      /* If a static var's type was incomplete when the decl was written,
+        but the type is complete now, lay out the decl now.  */
+      if (DECL_SIZE (exp) == 0 && TYPE_SIZE (TREE_TYPE (exp)) != 0
+         && (TREE_STATIC (exp) || DECL_EXTERNAL (exp)))
+       {
+         push_obstacks_nochange ();
+         end_temporary_allocation ();
+         layout_decl (exp, 0);
+         PUT_MODE (DECL_RTL (exp), DECL_MODE (exp));
+         pop_obstacks ();
+       }
+    case FUNCTION_DECL:
     case RESULT_DECL:
       if (DECL_RTL (exp) == 0)
        abort ();