[Bug c/39026] Gcc accepts invalid code
--- Comment #9 from hjl dot tools at gmail dot com 2009-01-31 17:43 --- The code is valid in gnu89 mode. -- hjl dot tools at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #7 from hjl dot tools at gmail dot com 2009-01-30 16:04 --- I think it is caused by revision 118356: http://gcc.gnu.org/ml/gcc-cvs/2006-11/msg7.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #8 from hjl dot tools at gmail dot com 2009-01-30 16:44 --- (In reply to comment #6) It would be a way more local change than changing what binds local (which also affects other languages). My proposal patch will bind undefined functions global, instead of local. It sounds safe to me. We can put it on trunk and wait a while before backporting it to 4.3 branch. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #1 from hjl dot tools at gmail dot com 2009-01-29 18:34 --- Icc 11.0 gave: [...@gnu-6 tmp]$ /opt/intel/cce/11.0/bin/icc -S i.i-Wall i.i(1): remark #1419: external declaration in primary source file inline void foo (); ^ [...@gnu-6 tmp]$ /opt/intel/cce/11.0/bin/icc -S i.i [...@gnu-6 tmp]$ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #2 from joseph at codesourcery dot com 2009-01-29 20:02 --- Subject: Re: New: Gcc accepts invalid code On Thu, 29 Jan 2009, hjl dot tools at gmail dot com wrote: inline void foo (); int main () { foo (); return 0; } [...@gnu-6 gcc]$ gcc /tmp/i.i -S If you use -std=c99 -pedantic-errors you get an error, as expected. You're compiling in gnu89 mode. If you use -std=c99 without -pedantic-errors you get a duplicate warning: t.c:1: warning: inline function 'foo' declared but never defined t.c:1: warning: inline function 'foo' declared but never defined -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #3 from hjl dot tools at gmail dot com 2009-01-29 20:09 --- (In reply to comment #2) If you use -std=c99 -pedantic-errors you get an error, as expected. You're compiling in gnu89 mode. If you use -std=c99 without -pedantic-errors you get a duplicate warning: t.c:1: warning: inline function 'foo' declared but never defined t.c:1: warning: inline function 'foo' declared but never defined So the code is valid in gnu89 mode, which is the default. With -std=c99 and without -pedantic-errors, shouldn't we generate working binary? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #4 from rguenther at suse dot de 2009-01-29 21:24 --- Subject: Re: Gcc accepts invalid code On Thu, 29 Jan 2009, joseph at codesourcery dot com wrote: --- Comment #2 from joseph at codesourcery dot com 2009-01-29 20:02 --- Subject: Re: New: Gcc accepts invalid code On Thu, 29 Jan 2009, hjl dot tools at gmail dot com wrote: inline void foo (); int main () { foo (); return 0; } [...@gnu-6 gcc]$ gcc /tmp/i.i -S If you use -std=c99 -pedantic-errors you get an error, as expected. You're compiling in gnu89 mode. If you use -std=c99 without -pedantic-errors you get a duplicate warning: t.c:1: warning: inline function 'foo' declared but never defined t.c:1: warning: inline function 'foo' declared but never defined I think the frontend should, in C89 mode and if just issueing a warning, set DECL_EXTERNAL properly on the decl. Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #5 from hjl dot tools at gmail dot com 2009-01-30 01:17 --- (In reply to comment #4) I think the frontend should, in C89 mode and if just issueing a warning, set DECL_EXTERNAL properly on the decl. Do we want to make such a change, especially for 4.3 branch? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026
[Bug c/39026] Gcc accepts invalid code
--- Comment #6 from rguenther at suse dot de 2009-01-30 06:52 --- Subject: Re: Gcc accepts invalid code On Fri, 30 Jan 2009, hjl dot tools at gmail dot com wrote: --- Comment #5 from hjl dot tools at gmail dot com 2009-01-30 01:17 --- (In reply to comment #4) I think the frontend should, in C89 mode and if just issueing a warning, set DECL_EXTERNAL properly on the decl. Do we want to make such a change, especially for 4.3 branch? It would be a way more local change than changing what binds local (which also affects other languages). Did you try to track down which change broke this in the first place? Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39026