From: jsm28 Date: Tue, 5 Oct 2004 19:54:26 +0000 (+0000) Subject: * c-decl.c (pushdecl): When an extern declaration at block scope X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=2d7a881f4ed589a3a7dd08f6dde445383700e383 * 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. 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 71aa4a9626f..71f86e0e474 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-10-05 Joseph S. Myers + + * 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 * tree-cfg.c (cleanup_tree_cfg): Remove extra parentheses in diff --git a/gcc/c-decl.c b/gcc/c-decl.c index cd003a3b972..415a7579239 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2046,6 +2046,7 @@ pushdecl (tree x) just need to fall through to make the declaration in this scope. */ nested = true; + x = visdecl; } else { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8849504824c..b95a6ee9ed1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-10-05 Joseph S. Myers + + * gcc.c-torture/compile/20041005-1.c: New test. + 2004-10-05 Nathan Sidwell 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 index 00000000000..b0a65117ec3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20041005-1.c @@ -0,0 +1,6 @@ +/* This wrongly caused duplicate definitions of x in the assembler + output. */ +/* Origin: Joseph Myers */ + +static int x = 1; +void f (void) { extern int x; }