public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20000] New: missing warning for noreturn function returning non-void
@ 2005-02-16 14:49 jsm28 at gcc dot gnu dot org
  2005-02-16 14:51 ` [Bug c/20000] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-02-16 14:49 UTC (permalink / raw)
  To: gcc-bugs

GCC warns for noreturn functions returning non-void, but only when declared
in the obsolete way using volatile.

typedef int ft(void);
volatile ft f;

warns "'noreturn' function returns non-void value", but

int f(void) __attribute__((noreturn));

does not.

-- 
           Summary: missing warning for noreturn function returning non-void
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/20000] missing warning for noreturn function returning non-void
  2005-02-16 14:49 [Bug c/20000] New: missing warning for noreturn function returning non-void jsm28 at gcc dot gnu dot org
@ 2005-02-16 14:51 ` pinskia at gcc dot gnu dot org
  2005-02-16 14:59 ` zack at codesourcery dot com
  2005-02-16 15:02 ` joseph at codesourcery dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-16 14:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-16 06:45 -------
Confirmed, it is ovbious where the bug is if we look at the source:
        /* GNU C interprets a volatile-qualified function type to indicate
           that the function does not return.  */
        if ((type_quals & TYPE_QUAL_VOLATILE) 
            && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
          warning ("%<noreturn%> function returns non-void value");

We don't check for the attribute at all.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-16 06:45:50
               date|                            |


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


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

* [Bug c/20000] missing warning for noreturn function returning non-void
  2005-02-16 14:49 [Bug c/20000] New: missing warning for noreturn function returning non-void jsm28 at gcc dot gnu dot org
  2005-02-16 14:51 ` [Bug c/20000] " pinskia at gcc dot gnu dot org
@ 2005-02-16 14:59 ` zack at codesourcery dot com
  2005-02-16 15:02 ` joseph at codesourcery dot com
  2 siblings, 0 replies; 4+ messages in thread
From: zack at codesourcery dot com @ 2005-02-16 14:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at codesourcery dot com  2005-02-16 06:48 -------
... because the attribute used to get translated to a volatile qualifier
on the function type, iirc.

-- 


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


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

* [Bug c/20000] missing warning for noreturn function returning non-void
  2005-02-16 14:49 [Bug c/20000] New: missing warning for noreturn function returning non-void jsm28 at gcc dot gnu dot org
  2005-02-16 14:51 ` [Bug c/20000] " pinskia at gcc dot gnu dot org
  2005-02-16 14:59 ` zack at codesourcery dot com
@ 2005-02-16 15:02 ` joseph at codesourcery dot com
  2 siblings, 0 replies; 4+ messages in thread
From: joseph at codesourcery dot com @ 2005-02-16 15:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joseph at codesourcery dot com  2005-02-16 06:51 -------
Subject: Re:  missing warning for noreturn function returning
 non-void

On Wed, 16 Feb 2005, zack at codesourcery dot com wrote:

> ... because the attribute used to get translated to a volatile qualifier
> on the function type, iirc.

It does still get translated - but not until some time after 
grokdeclarator where the warning is.



-- 


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


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

end of thread, other threads:[~2005-02-16  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-16 14:49 [Bug c/20000] New: missing warning for noreturn function returning non-void jsm28 at gcc dot gnu dot org
2005-02-16 14:51 ` [Bug c/20000] " pinskia at gcc dot gnu dot org
2005-02-16 14:59 ` zack at codesourcery dot com
2005-02-16 15:02 ` joseph at codesourcery 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).