public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Matthias Klose <doko@smile.cs.tu-berlin.de>
To: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Subject: c/8609: Superfluous warning when -std=c99/gnu99 and noreturn on main()
Date: Fri, 22 Nov 2002 09:46:00 -0000	[thread overview]
Message-ID: <E18D2Vn-0001t3-00@smile.cs.tu-berlin.de> (raw)


>Number:         8609
>Category:       c
>Synopsis:       Superfluous warning when -std=c99/gnu99 and noreturn on main()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 16 05:06:03 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Agthorr <agthorr@barsoom.org>
>Release:        3.2.1 (Debian) (Debian unstable)
>Organization:
The Debian Project
>Environment:
System: Debian GNU/Linux (unstable)
Architecture: i686
Configured with: /home/packages/gcc/3.2/gcc-3.2-3.2.1ds5/src/configure -v --enable-languages=c,c++,java,f77,proto,objc,ada --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-java-gc=boehm --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #141015.
  Please CC 141015@bugs.debian.org on replies.
  Log of report can be found at http://bugs.debian.org/141015 ]

[ rechecked with gcc-3.2.1 prerelease ]

The following program generates a superfluous warning when compiled
with -std=c99 or -std=gnu99.

------------------------------------------------------------------------
#include <stdlib.h>
int main (void) __attribute__ ((noreturn));
int main (void)
{
        exit(1);
}
------------------------------------------------------------------------
volition:~/tmp$ gcc-3.0 -std=c99  -c test.c
test.c: In function `main':
test.c:6: warning: function declared `noreturn' has a `return' statement
volition:~/tmp$
------------------------------------------------------------------------

Obviously, this warning is bogus since there is no return statement
anywhere in the program :>  The warning is not produced by gcc 2.95.4
nor in the default -std=gnu89 mode.

Although this example is trivial, I encountered the bug in an actual
program that depends on -std=gnu99 (since C99 features are used).  In
the program, main() starts an event loop which never directly returns;
the program exits by calling exit().
	
>How-To-Repeat:
	
>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-11-16 13:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-22  9:46 Matthias Klose [this message]
2002-11-24 13:30 bangerth
2002-11-24 17:24 Agthorr
2002-11-25  0:46 Wolfgang Bangerth
2002-11-25  7:16 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E18D2Vn-0001t3-00@smile.cs.tu-berlin.de \
    --to=doko@smile.cs.tu-berlin.de \
    --cc=141015@bugs.debian.org \
    --cc=debian-gcc@lists.debian.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).