public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn'
@ 2012-01-26  0:18 gnumaurorusso at gmail dot com
  2012-01-26  0:46 ` [Bug c++/52003] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gnumaurorusso at gmail dot com @ 2012-01-26  0:18 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52003
           Summary: warning about (un)existing return statement in the
                    main function declared 'noreturn'
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gnumaurorusso@gmail.com


this function generates the warning :

function declared 'noreturn' has a 'return' statement

(at least it does with
-funsigned-char -funsigned-bitfields -O0 -fpack-struct -fshort-enums -g2 -Wall
options)

__attribute__((noreturn)) int main(void){
   while(1);
}


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

* [Bug c++/52003] warning about (un)existing return statement in the main function declared 'noreturn'
  2012-01-26  0:18 [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn' gnumaurorusso at gmail dot com
@ 2012-01-26  0:46 ` redi at gcc dot gnu.org
  2012-01-26  0:47 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2012-01-26  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-01-26 00:14:40 UTC ---
That's not the right syntax for declaring attributes of functions.


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

* [Bug c++/52003] warning about (un)existing return statement in the main function declared 'noreturn'
  2012-01-26  0:18 [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn' gnumaurorusso at gmail dot com
  2012-01-26  0:46 ` [Bug c++/52003] " redi at gcc dot gnu.org
@ 2012-01-26  0:47 ` pinskia at gcc dot gnu.org
  2012-01-26 13:18 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-26  0:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-26 00:18:15 UTC ---
main has an implicit return 0 if it follows through to the end according to the
C++ standard IIRC.


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

* [Bug c++/52003] warning about (un)existing return statement in the main function declared 'noreturn'
  2012-01-26  0:18 [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn' gnumaurorusso at gmail dot com
  2012-01-26  0:46 ` [Bug c++/52003] " redi at gcc dot gnu.org
  2012-01-26  0:47 ` pinskia at gcc dot gnu.org
@ 2012-01-26 13:18 ` rguenth at gcc dot gnu.org
  2012-01-27  6:43 ` gnumaurorusso at gmail dot com
  2012-10-14 15:43 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-26 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-26
     Ever Confirmed|0                           |1

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-26 11:19:02 UTC ---
(In reply to comment #2)
> main has an implicit return 0 if it follows through to the end according to the
> C++ standard IIRC.

Indeed it does.  GCC simply tells you that putting 'noreturn' on main
is not good.

If we don't want this warning maybe the C++ FE should mark that return
stmt with TREE_NO_WARNING and we should honor that flag.


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

* [Bug c++/52003] warning about (un)existing return statement in the main function declared 'noreturn'
  2012-01-26  0:18 [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn' gnumaurorusso at gmail dot com
                   ` (2 preceding siblings ...)
  2012-01-26 13:18 ` rguenth at gcc dot gnu.org
@ 2012-01-27  6:43 ` gnumaurorusso at gmail dot com
  2012-10-14 15:43 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: gnumaurorusso at gmail dot com @ 2012-01-27  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from mauro <gnumaurorusso at gmail dot com> 2012-01-27 00:27:43 UTC ---
(In reply to comment #2)
> main has an implicit return 0 if it follows through to the end according to the
> C++ standard IIRC.

Ok, I thought it was something like that.
Thanks for answer.


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

* [Bug c++/52003] warning about (un)existing return statement in the main function declared 'noreturn'
  2012-01-26  0:18 [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn' gnumaurorusso at gmail dot com
                   ` (3 preceding siblings ...)
  2012-01-27  6:43 ` gnumaurorusso at gmail dot com
@ 2012-10-14 15:43 ` paolo.carlini at oracle dot com
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-10-14 15:43 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-14 15:43:06 UTC ---
Closing.


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

end of thread, other threads:[~2012-10-14 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26  0:18 [Bug c++/52003] New: warning about (un)existing return statement in the main function declared 'noreturn' gnumaurorusso at gmail dot com
2012-01-26  0:46 ` [Bug c++/52003] " redi at gcc dot gnu.org
2012-01-26  0:47 ` pinskia at gcc dot gnu.org
2012-01-26 13:18 ` rguenth at gcc dot gnu.org
2012-01-27  6:43 ` gnumaurorusso at gmail dot com
2012-10-14 15:43 ` paolo.carlini at oracle dot com

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