public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12603] New: No return statement warning on function that never returns with -O3
@ 2003-10-13 22:19 james at ittc dot ku dot edu
2003-10-18 18:28 ` [Bug optimization/12603] " pinskia at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: james at ittc dot ku dot edu @ 2003-10-13 22:19 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
Summary: No return statement warning on function that never
returns with -O3
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: james at ittc dot ku dot edu
CC: gcc-bugs at gcc dot gnu dot org,james at ittc dot ku dot
edu
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
The following function compiles without warning at optimization level -O2 or
below. With -Wall -O3, gcc says:
noreturn.c: In function `this_function_never_returns':
noreturn.c:5: warning: no return statement in function returning non-void
This happens with gcc 3.2.2 - 3.3.1, at least.
int
this_function_never_returns ()
{
for (;;);
}
This is an extremely stripped down version of a problem with XEmacs and
Fcommand_loop_1, which must be declared to return a Lisp_Object (since it is a
Lisp-visible function), but which contains an infinite loop. The obvious
solution of putting a return statement at the end causes some compilers to
complain about unreachable code. Adding __attribute__ ((noreturn)) did not make
the warning go away.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/12603] No return statement warning on function that never returns with -O3
2003-10-13 22:19 [Bug c/12603] New: No return statement warning on function that never returns with -O3 james at ittc dot ku dot edu
@ 2003-10-18 18:28 ` pinskia at gcc dot gnu dot org
2003-11-24 20:54 ` kazu at cs dot umass dot edu
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-18 18:28 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Component|c |optimization
Ever Confirmed| |1
Keywords| |diagnostic
Last reconfirmed|0000-00-00 00:00:00 |2003-10-18 17:44:11
date| |
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-18 17:44 -------
This should not warn at -O3, I think this is related to the control flow graph some how.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/12603] No return statement warning on function that never returns with -O3
2003-10-13 22:19 [Bug c/12603] New: No return statement warning on function that never returns with -O3 james at ittc dot ku dot edu
2003-10-18 18:28 ` [Bug optimization/12603] " pinskia at gcc dot gnu dot org
@ 2003-11-24 20:54 ` kazu at cs dot umass dot edu
2003-11-24 22:51 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2003-11-24 20:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From kazu at cs dot umass dot edu 2003-11-24 20:54 -------
This problem does not seem to occur with gcc-3.4 20031124.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug optimization/12603] No return statement warning on function that never returns with -O3
2003-10-13 22:19 [Bug c/12603] New: No return statement warning on function that never returns with -O3 james at ittc dot ku dot edu
2003-10-18 18:28 ` [Bug optimization/12603] " pinskia at gcc dot gnu dot org
2003-11-24 20:54 ` kazu at cs dot umass dot edu
@ 2003-11-24 22:51 ` pinskia at gcc dot gnu dot org
2004-03-06 5:49 ` [Bug c/12603] " pinskia at gcc dot gnu dot org
2004-05-02 15:37 ` zwin at users dot sourceforge dot net
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-24 22:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-24 22:51 -------
I can still reproduce it with the mainline (20031124).
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-10-18 17:44:11 |2003-11-24 22:51:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/12603] No return statement warning on function that never returns with -O3
2003-10-13 22:19 [Bug c/12603] New: No return statement warning on function that never returns with -O3 james at ittc dot ku dot edu
` (2 preceding siblings ...)
2003-11-24 22:51 ` pinskia at gcc dot gnu dot org
@ 2004-03-06 5:49 ` pinskia at gcc dot gnu dot org
2004-05-02 15:37 ` zwin at users dot sourceforge dot net
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-06 5:49 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-06 05:48 -------
The problem is that -O3, DECL_INLINE for the function decl becomes true because -O3
enables -finline-functions. So it looks like a different check is needed for the C front-end.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|optimization |c
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/12603] No return statement warning on function that never returns with -O3
2003-10-13 22:19 [Bug c/12603] New: No return statement warning on function that never returns with -O3 james at ittc dot ku dot edu
` (3 preceding siblings ...)
2004-03-06 5:49 ` [Bug c/12603] " pinskia at gcc dot gnu dot org
@ 2004-05-02 15:37 ` zwin at users dot sourceforge dot net
4 siblings, 0 replies; 6+ messages in thread
From: zwin at users dot sourceforge dot net @ 2004-05-02 15:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From zwin at users dot sourceforge dot net 2004-05-02 15:36 -------
I am also getting this warning about no return statement for methods in C++.
While a global function int noret() { for (;;); } does not fire the warning, the
same in a method does (3.2.3).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-05-02 15:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-13 22:19 [Bug c/12603] New: No return statement warning on function that never returns with -O3 james at ittc dot ku dot edu
2003-10-18 18:28 ` [Bug optimization/12603] " pinskia at gcc dot gnu dot org
2003-11-24 20:54 ` kazu at cs dot umass dot edu
2003-11-24 22:51 ` pinskia at gcc dot gnu dot org
2004-03-06 5:49 ` [Bug c/12603] " pinskia at gcc dot gnu dot org
2004-05-02 15:37 ` zwin at users dot sourceforge dot net
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).