aboutsummaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2001-05-20 20:41:49 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2001-05-20 16:41:49 -0400
commiteabb9ed02da2738eb1fa31cc0d1d99a84cb0b713 (patch)
tree93b10e46ccc7b008bb3c649c025846cc662482ca /gcc/stmt.c
parentd9214e537de1b3251676c568012d1eedc69ccc2f (diff)
downloadgcc-eabb9ed02da2738eb1fa31cc0d1d99a84cb0b713.zip
gcc-eabb9ed02da2738eb1fa31cc0d1d99a84cb0b713.tar.gz
gcc-eabb9ed02da2738eb1fa31cc0d1d99a84cb0b713.tar.bz2
* stmt.c (expand_decl): Set mode, alignment, and sizes for CONST_DECL.
From-SVN: r42360
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 433908a..c20a99e 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -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;