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
  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
  0 siblings, 2 replies; 7+ 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] 7+ messages in thread

end of thread, other threads:[~2008-10-20 20:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
2007-02-15 19:30 ` [Bug c/12603] No return statement warning on function that never returns with -O3 pinskia at gcc dot gnu dot org
2008-08-29 13:29 ` manu at gcc dot gnu dot org
2008-10-20 18:29 ` manu at gcc dot gnu dot org
2008-10-20 18:30 ` manu at gcc dot gnu dot org
2008-10-20 20:44 ` pinskia at gcc dot gnu dot org
2003-10-13 22:19 [Bug c/12603] New: " james at ittc dot ku dot edu
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).