aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-03-11 07:21:22 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-03-11 07:21:22 -0500
commit7d49f92a42266a582f1c2be94b8ac615240c74ce (patch)
tree176b32845a60db457933045f44bb718546270c38 /gcc/c-decl.c
parent36281332fcb18c598b0616294b48d4a579314813 (diff)
downloadgcc-7d49f92a42266a582f1c2be94b8ac615240c74ce.zip
gcc-7d49f92a42266a582f1c2be94b8ac615240c74ce.tar.gz
gcc-7d49f92a42266a582f1c2be94b8ac615240c74ce.tar.bz2
(finish_decl): When preserving an initializer, ensure its type is on a
good obstack. From-SVN: r6742
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 889a185..af0cf1b 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3588,6 +3588,12 @@ finish_decl (decl, init, asmspec_tree)
output_constant_def to make its rtl on the permanent
obstack. */
TREE_PERMANENT (DECL_INITIAL (decl)) = 1;
+
+ /* The initializer and DECL must have the same (or equivalent
+ types), but if the initializer is a STRING_CST, its type
+ might not be on the right obstack, so copy the type
+ of DECL. */
+ TREE_TYPE (DECL_INITIAL (decl)) = type;
}
else
DECL_INITIAL (decl) = error_mark_node;