This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14366] variable previously declared `static' redeclared `extern' is valid ISO C - 3.4 and 3.5 regression
- From: "jsm at polyomino dot org dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Mar 2004 18:15:23 -0000
- Subject: [Bug c/14366] variable previously declared `static' redeclared `extern' is valid ISO C - 3.4 and 3.5 regression
- References: <20040301165520.14366.amylaar@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jsm at polyomino dot org dot uk 2004-03-01 18:15 -------
Subject: Re: New: variable previously declared `static' redeclared
`extern' is valid ISO C - 3.4 and 3.5 regression
On Mon, 1 Mar 2004, amylaar at gcc dot gnu dot org wrote:
> The ISO 9899:1990 standard says in 6.1.2.2 Linkages of identifiers:
>
> If the declaration of an identifier for an object or a function contains the
> storage class specifier extern, the identifier has the same linkage as any
> visible declaration of the identifier with file scope.
>
> Therefore, for 9899:1990 both my testcase and the old scope-2.c testcase
> should pass.
This paragraph was replaced in C90 TC1 following DR#011. So I don't think
we should do anything differently between C90 and C99 mode here. Your
testcase should pass, while scope-2.c has undefined behavior (same
identifier appears with both internal and external linkage in the same
translation unit) and the error is appropriate.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14366