OSDN Git Service

* c-decl.c (pushdecl): When an extern declaration at block scope
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 2004 19:54:26 +0000 (19:54 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Oct 2004 19:54:26 +0000 (19:54 +0000)
refers to a visible entity with internal linkage, use the old DECL
rather than the new one.

testsuite:
* gcc.c-torture/compile/20041005-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88570 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20041005-1.c [new file with mode: 0644]

index 71aa4a9..71f86e0 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-05  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       * c-decl.c (pushdecl): When an extern declaration at block scope
+       refers to a visible entity with internal linkage, use the old DECL
+       rather than the new one.
+
 2004-10-05  Kazu Hirata  <kazu@cs.umass.edu>
 
        * tree-cfg.c (cleanup_tree_cfg): Remove extra parentheses in
 2004-10-05  Kazu Hirata  <kazu@cs.umass.edu>
 
        * tree-cfg.c (cleanup_tree_cfg): Remove extra parentheses in
index cd003a3..415a757 100644 (file)
@@ -2046,6 +2046,7 @@ pushdecl (tree x)
                 just need to fall through to make the declaration in
                 this scope.  */
              nested = true;
                 just need to fall through to make the declaration in
                 this scope.  */
              nested = true;
+             x = visdecl;
            }
          else
            {
            }
          else
            {
index 8849504..b95a6ee 100644 (file)
@@ -1,3 +1,7 @@
+2004-10-05  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       * gcc.c-torture/compile/20041005-1.c: New test.
+
 2004-10-05  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/17829
 2004-10-05  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/17829
diff --git a/gcc/testsuite/gcc.c-torture/compile/20041005-1.c b/gcc/testsuite/gcc.c-torture/compile/20041005-1.c
new file mode 100644 (file)
index 0000000..b0a6511
--- /dev/null
@@ -0,0 +1,6 @@
+/* This wrongly caused duplicate definitions of x in the assembler
+   output.  */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+
+static int x = 1;
+void f (void) { extern int x; }