public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration
@ 2004-12-02 21:21 markus at oberhumer dot com
2004-12-02 21:24 ` [Bug c/18799] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: markus at oberhumer dot com @ 2004-12-02 21:21 UTC (permalink / raw)
To: gcc-bugs
This code used to give a warning on gcc 3.2 and gcc 3.3, gcc 3.4 does not warn
at all, and current mainline 4.0 makes this an error.
What do the C89 and C99 standards actually say here ?
+ cat x.c
extern int x[];
static int x[2];
int *foo(void) { return x; }
+ gcc-3.2 -std=c89 -Wall -W -pedantic -c x.c
x.c:2: warning: static declaration for `x' follows non-static
+ gcc-3.3 -std=c89 -Wall -W -pedantic -c x.c
x.c:2: warning: static declaration for `x' follows non-static
+ gcc-3.4 -std=c89 -Wall -W -pedantic -c x.c
+ gcc-4.0 -std=c89 -Wall -W -pedantic -c x.c
x.c:2: error: static declaration of 'x' follows non-static declaration
x.c:1: error: previous declaration of 'x' was here
+ gcc-3.2 -std=c99 -Wall -W -pedantic -c x.c
x.c:2: warning: static declaration for `x' follows non-static
+ gcc-3.3 -std=c99 -Wall -W -pedantic -c x.c
x.c:2: warning: static declaration for `x' follows non-static
+ gcc-3.4 -std=c99 -Wall -W -pedantic -c x.c
+ gcc-4.0 -std=c99 -Wall -W -pedantic -c x.c
x.c:2: error: static declaration of 'x' follows non-static declaration
x.c:1: error: previous declaration of 'x' was here
--
Summary: error: static declaration of 'x' follows non-static
declaration
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: markus at oberhumer dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18799] error: static declaration of 'x' follows non-static declaration
2004-12-02 21:21 [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration markus at oberhumer dot com
@ 2004-12-02 21:24 ` pinskia at gcc dot gnu dot org
2004-12-02 23:12 ` markus at oberhumer dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-02 21:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-02 21:24 -------
The C standard says this is invalid code which is why 4.0.0 errors out.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18799] error: static declaration of 'x' follows non-static declaration
2004-12-02 21:21 [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration markus at oberhumer dot com
2004-12-02 21:24 ` [Bug c/18799] " pinskia at gcc dot gnu dot org
@ 2004-12-02 23:12 ` markus at oberhumer dot com
2004-12-02 23:23 ` [Bug c/18799] [3.4 Regression] " pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: markus at oberhumer dot com @ 2004-12-02 23:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From markus at oberhumer dot com 2004-12-02 23:12 -------
I'm reopening this against gcc-3.4.3 then, as the warning has vanished - a
possible regression against 3.2 and 3.3.
Note that gcc-3.4.3/gcc/c-decl.c talks about -Wtraditional, but even that
doesn't make the warning appear.
Please feel free to close this bug again if you disagree.
> gcc-3.3 -c -Wall -W -Wtraditional -pedantic x.c
x.c:2: warning: static declaration for `x' follows non-static
x.c: In function `foo':
x.c:3: warning: traditional C rejects ISO C style function definitions
> gcc-3.4.3 -c -Wall -W -Wtraditional -pedantic x.c
x.c: In function `foo':
x.c:3: warning: traditional C rejects ISO C style function definitions
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |
Version|4.0.0 |3.4.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18799] [3.4 Regression] error: static declaration of 'x' follows non-static declaration
2004-12-02 21:21 [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration markus at oberhumer dot com
2004-12-02 21:24 ` [Bug c/18799] " pinskia at gcc dot gnu dot org
2004-12-02 23:12 ` markus at oberhumer dot com
@ 2004-12-02 23:23 ` pinskia at gcc dot gnu dot org
2004-12-03 9:13 ` falk at debian dot org
2005-04-30 0:04 ` jsm28 at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-02 23:23 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Known to fail| |3.4.3
Known to work| |3.3.3 4.0.0
Summary|error: static declaration of|[3.4 Regression] error:
|'x' follows non-static |static declaration of 'x'
|declaration |follows non-static
| |declaration
Target Milestone|4.0.0 |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18799] [3.4 Regression] error: static declaration of 'x' follows non-static declaration
2004-12-02 21:21 [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration markus at oberhumer dot com
` (2 preceding siblings ...)
2004-12-02 23:23 ` [Bug c/18799] [3.4 Regression] " pinskia at gcc dot gnu dot org
@ 2004-12-03 9:13 ` falk at debian dot org
2005-04-30 0:04 ` jsm28 at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: falk at debian dot org @ 2004-12-03 9:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2004-12-03 09:13 -------
Confirmed. I think we should even warn about this unconditionally and not
only with -pedantic.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/18799] [3.4 Regression] error: static declaration of 'x' follows non-static declaration
2004-12-02 21:21 [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration markus at oberhumer dot com
` (3 preceding siblings ...)
2004-12-03 9:13 ` falk at debian dot org
@ 2005-04-30 0:04 ` jsm28 at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-04-30 0:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-04-30 00:04 -------
Fixed in 4.0.0. c-decl.c in 3.4 was part way through a rewrite and
that intermediate version is fairly buggy and fragile, so backporting
fixes to that version seems inadvisable.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu dot org
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|3.4.4 |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18799
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-04-30 0:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-02 21:21 [Bug c/18799] New: error: static declaration of 'x' follows non-static declaration markus at oberhumer dot com
2004-12-02 21:24 ` [Bug c/18799] " pinskia at gcc dot gnu dot org
2004-12-02 23:12 ` markus at oberhumer dot com
2004-12-02 23:23 ` [Bug c/18799] [3.4 Regression] " pinskia at gcc dot gnu dot org
2004-12-03 9:13 ` falk at debian dot org
2005-04-30 0:04 ` jsm28 at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).