]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-decl.c (implicitly_declare): Copy declarations that are going to be placed in a...
authorMark Mitchell <mark@codesourcery.com>
Tue, 15 Apr 2003 16:35:52 +0000 (16:35 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 15 Apr 2003 16:35:52 +0000 (16:35 +0000)
* c-decl.c (implicitly_declare): Copy declarations that are going
to be placed in a local scope.

From-SVN: r65646

gcc/ChangeLog
gcc/c-decl.c

index 5e62bc23351081bd7861522f78e18ca307a46f66..23feddfdbec0dd6296dc1db97b7652484562132c 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-15  Mark Mitchell  <mark@codesourcery.com>
+
+       * c-decl.c (implicitly_declare): Copy declarations that are going
+       to be placed in a local scope.
+
 2003-04-15  James A. Morrison  <ja2morri@uwaterloo.ca>
 
        * invoke.texi (Spec Files): Wrap if-exists-else example.
index 50b7219b39355838565dea7141c213583582d862..0614476c00e2816b7fe3ea4de5e656d72fd8afad 100644 (file)
@@ -1872,7 +1872,13 @@ implicitly_declare (functionid)
            warning_with_decl (decl, "previous declaration of `%s'");
          C_DECL_IMPLICIT (decl) = 1;
        }
-      return pushdecl (decl);
+      /* If this function is global, then it must already be in the
+        global binding level, so there's no need to push it again.  */
+      if (current_binding_level == global_binding_level)
+       return decl;
+      /* If this is a local declaration, make a copy; we can't have
+        the same DECL listed in two different binding levels.  */
+      return pushdecl (copy_node (decl));
     }
 
   /* Not seen before.  */