From 7d49f92a42266a582f1c2be94b8ac615240c74ce Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Fri, 11 Mar 1994 07:21:22 -0500 Subject: [PATCH] (finish_decl): When preserving an initializer, ensure its type is on a good obstack. From-SVN: r6742 --- gcc/c-decl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 889a185209f..af0cf1ba256 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; -- 2.30.2