(finish_decl): When preserving an initializer, ensure its type is on a
authorRichard Kenner <kenner@gcc.gnu.org>
Fri, 11 Mar 1994 12:21:22 +0000 (07:21 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Fri, 11 Mar 1994 12:21:22 +0000 (07:21 -0500)
good obstack.

From-SVN: r6742

gcc/c-decl.c

index 889a185..af0cf1b 100644 (file)
@@ -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;