tree.c (perm_manip): Also regenerate the RTL of an extern.
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 6 May 1998 02:40:36 +0000 (02:40 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 6 May 1998 02:40:36 +0000 (22:40 -0400)
* tree.c (perm_manip): Also regenerate the RTL of an extern.
(copy_to_permanent): Use end_temporary_allocation.

From-SVN: r19560

gcc/cp/ChangeLog
gcc/cp/tree.c

index 6b34102006d91aa686a9dcda9c0bb36891588bc4..ce8d77066407e6170e740faed71854442d873c5b 100644 (file)
@@ -1,3 +1,8 @@
+Wed May  6 02:33:39 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * tree.c (perm_manip): Also regenerate the RTL of an extern.
+       (copy_to_permanent): Use end_temporary_allocation.
+
 Tue May  5 23:54:04 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * init.c (expand_vec_init): The initialization of each array
index 3b4ca22efc9bd5f96a159511a83bd0203e335a26..fc9fd37d953892174b7eec428f2cf056ffc5216c 100644 (file)
@@ -1685,10 +1685,19 @@ perm_manip (t)
 {
   if (TREE_PERMANENT (t))
     return t;
+
   /* Support `void f () { extern int i; A<&i> a; }' */
   if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == FUNCTION_DECL)
       && TREE_PUBLIC (t))
-    return copy_node (t);
+    {
+      t = copy_node (t);
+
+      /* copy_rtx won't make a new SYMBOL_REF, so call make_decl_rtl again.  */
+      DECL_RTL (t) = 0;
+      make_decl_rtl (t, NULL_PTR, 1);
+
+      return t;
+    }
   return NULL_TREE;
 }
 
@@ -1699,22 +1708,15 @@ tree
 copy_to_permanent (t)
      tree t;
 {
-  register struct obstack *ambient_obstack = current_obstack;
-  register struct obstack *ambient_saveable_obstack = saveable_obstack;
-  register struct obstack *ambient_expression_obstack = expression_obstack;
-
   if (t == NULL_TREE || TREE_PERMANENT (t))
     return t;
 
-  saveable_obstack = &permanent_obstack;
-  current_obstack = saveable_obstack;
-  expression_obstack = saveable_obstack;
+  push_obstacks_nochange ();
+  end_temporary_allocation ();
 
   t = mapcar (t, perm_manip);
 
-  current_obstack = ambient_obstack;
-  saveable_obstack = ambient_saveable_obstack;
-  expression_obstack = ambient_expression_obstack;
+  pop_obstacks ();
 
   return t;
 }