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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ messages in thread

* [Bug c/12603] No return statement warning on function that never returns with -O3
       [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2008-10-20 18:30 ` manu at gcc dot gnu dot org
@ 2008-10-20 20:44 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-10-20 20:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2008-10-20 20:42 -------
(In reply to comment #9)
> This got fixed somehow. There is a testcase in the testsuite to make sure we do
> not regress.

This was most likely fixed by:
2008-09-17  Jan Hubicka  <jh@suse.cz>

        PR c++/18071
        * tree.h (DECL_INLINE): remove.
        (DECL_DECLARED_INLINE_P): Update docs.
        (DECL_NO_INLINE_WARNING_P): new.
        (tree_function_decl): Replace inline_flag by no_inline_warning_flag.
        * tree-inline.c (inlinable_function_p): Set DECL_NO_INLINE_WARNING_P.

:)
Which removed DECL_INLINE.  As I mentioned in comment #4 DECL_INLINE was the
issue.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/12603] No return statement warning on function that never returns with -O3
       [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-20 18:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from manu at gcc dot gnu dot org  2008-10-20 18:28 -------
This got fixed somehow. There is a testcase in the testsuite to make sure we do
not regress.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/12603] No return statement warning on function that never returns with -O3
       [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
  2007-02-15 19:30 ` 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
  4 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-10-20 18:29 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]



------- Comment #8 from manu at gcc dot gnu dot org  2008-10-20 18:27 -------
Subject: Bug 12603

Author: manu
Date: Mon Oct 20 18:26:21 2008
New Revision: 141244

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141244
Log:
2008-10-20  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR 12603
        * gcc.dg/pr12603.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr12603.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/12603] No return statement warning on function that never returns with -O3
       [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
  2007-02-15 19:30 ` 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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-08-29 13:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from manu at gcc dot gnu dot org  2008-08-29 13:28 -------
No warning in GCC 4.4 with any of those:

-O0 -Wall -Wextra -Wreturn-type -Wunreachable-code
-O1 -Wall -Wextra -Wreturn-type -Wunreachable-code
-O2 -Wall -Wextra -Wreturn-type -Wunreachable-code
-O3 -Wall -Wextra -Wreturn-type -Wunreachable-code
-O3 -finline -Wall -Wextra -Wreturn-type -Wunreachable-code

If you can reproduce the problem in a recent GCC, let us know. I will add the
testcase to the testsuite before closing this.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
      Known to fail|                            |4.4.0
   Last reconfirmed|2005-12-18 00:38:04         |2008-08-29 13:28:06
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug c/12603] No return statement warning on function that never returns with -O3
       [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
@ 2007-02-15 19:30 ` pinskia at gcc dot gnu dot org
  2008-08-29 13:29 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-02-15 19:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-02-15 19:30 -------
*** Bug 30794 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603


^ permalink raw reply	[flat|nested] 11+ messages in thread

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

Thread overview: 11+ 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
     [not found] <bug-12603-7144@http.gcc.gnu.org/bugzilla/>
2007-02-15 19:30 ` 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

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).