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