(integrate_decl_tree): Only set DECL_ABSTRACT_ORIGIN if the decl
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 19 Jun 1995 23:27:01 +0000 (19:27 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 19 Jun 1995 23:27:01 +0000 (19:27 -0400)
returned by pushdecl is the one we started with.

From-SVN: r10018

gcc/integrate.c

index 64248047371b32ceba12b815c88ec81af34a9773..525977acecaec431b94d65ca1cb9e2c941df10f2 100644 (file)
@@ -1968,6 +1968,7 @@ integrate_decl_tree (let, level, map)
   for (t = BLOCK_VARS (let); t; t = TREE_CHAIN (t))
     {
       tree d;
+      tree newd;
 
       push_obstacks_nochange ();
       saveable_allocation ();
@@ -1986,13 +1987,19 @@ integrate_decl_tree (let, level, map)
        }
       /* These args would always appear unused, if not for this.  */
       TREE_USED (d) = 1;
-      /* Prevent warning for shadowing with these.  */
-      DECL_ABSTRACT_ORIGIN (d) = t;
 
       if (DECL_LANG_SPECIFIC (d))
        copy_lang_decl (d);
 
-      pushdecl (d);
+      newd = pushdecl (d);
+
+      /* If the decl we get back is the copy of 't' that we started with,
+        then set the DECL_ABSTRACT_ORIGIN.  Otherwise, we must have a
+        duplicate decl, and we got the older one back.  In that case, setting
+        DECL_ABSTRACT_ORIGIN is not appropriate.  */
+      if (newd == d)
+       /* Prevent warning for shadowing with these.  */
+       DECL_ABSTRACT_ORIGIN (d) = t;
     }
 
   for (t = BLOCK_SUBBLOCKS (let); t; t = TREE_CHAIN (t))