(integrate_decl_tree): Set DECL_ABTRACT_ORIGIN before pushdecl call
authorRichard Kenner <kenner@gcc.gnu.org>
Sun, 2 Jul 1995 00:15:29 +0000 (20:15 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 2 Jul 1995 00:15:29 +0000 (20:15 -0400)
for local variables.

From-SVN: r10102

gcc/integrate.c

index 525977acecaec431b94d65ca1cb9e2c941df10f2..dfc33f960bc8557ab8caac50e5ebbb1bf61431b9 100644 (file)
@@ -1991,14 +1991,23 @@ integrate_decl_tree (let, level, map)
       if (DECL_LANG_SPECIFIC (d))
        copy_lang_decl (d);
 
+      /* Must set DECL_ABSTRACT_ORIGIN here for local variables, to ensure
+        that we don't get -Wshadow warnings.  But don't set it here if
+        pushdecl might return a duplicate decl, as that will result in
+        incorrect DWARF debug info.  */
+      if (! DECL_EXTERNAL (d) || ! TREE_PUBLIC (d))
+       /* Prevent warning for shadowing with these.  */
+       DECL_ABSTRACT_ORIGIN (d) = t;
+
       newd = pushdecl (d);
 
-      /* If the decl we get back is the copy of 't' that we started with,
+      /* If we didn't set DECL_ABSTRACT_ORIGIN above, then set it now.
+        Simpler to just set it always rather than checking.
+        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;
     }