* stmt.c (expand_decl): Set mode, alignment, and sizes for CONST_DECL.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Sun, 20 May 2001 20:41:49 +0000 (20:41 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 20 May 2001 20:41:49 +0000 (16:41 -0400)
From-SVN: r42360

gcc/ChangeLog
gcc/stmt.c

index 1ed2011415b429e74d1478a24217657bcf2a7d98..c791d466caf479fea47aa6ac4863c73fd5eb3ca9 100644 (file)
@@ -1,3 +1,7 @@
+Sun May 20 16:39:24 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * stmt.c (expand_decl): Set mode, alignment, and sizes for CONST_DECL.
+
 2001-05-20  Richard Henderson  <rth@redhat.com>
 
        * sched-deps.c (sched_analyze_insn): Force volatile memory reads
index 433908aa02421274891070f29a364ef0fb2881a8..c20a99e6ad22f651d4b308cc6688a0830b902d70 100644 (file)
@@ -3749,14 +3749,24 @@ expand_decl (decl)
 
   type = TREE_TYPE (decl);
 
-  /* Only automatic variables need any expansion done.
-     Static and external variables, and external functions,
-     will be handled by `assemble_variable' (called from finish_decl).
-     TYPE_DECL and CONST_DECL require nothing.
-     PARM_DECLs are handled in `assign_parms'.  */
+  /* For a CONST_DECL, set mode, alignment, and sizes from those of the
+     type in case this node is used in a reference.  */
+  if (TREE_CODE (decl) == CONST_DECL)
+    {
+      DECL_MODE (decl) = TYPE_MODE (type);
+      DECL_ALIGN (decl) = TYPE_ALIGN (type);
+      DECL_SIZE (decl) = TYPE_SIZE (type);
+      DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (type);
+      return;
+    }
 
+  /* Otherwise, only automatic variables need any expansion done.  Static and
+     external variables, and external functions, will be handled by
+     `assemble_variable' (called from finish_decl).  TYPE_DECL requires
+     nothing.  PARM_DECLs are handled in `assign_parms'.  */
   if (TREE_CODE (decl) != VAR_DECL)
     return;
+
   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl))
     return;