[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#141015: gcc-3.0: Superfluous warning when -std=c99/gnu99 and noreturn on main()



Package: gcc-3.0
Version: 1:3.0.4-6
Severity: normal

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

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux volition 2.4.18volition #1 Thu Mar 28 20:13:24 PST 2002 i686
Locale: LANG=C, LC_CTYPE=

Versions of packages gcc-3.0 depends on:
ii  binutils                   2.12.90.0.1-1 The GNU assembler, linker and bina
ii  cpp-3.0                    1:3.0.4-6     The GNU C preprocessor.
ii  gcc-3.0-base               1:3.0.4-6     The GNU Compiler Collection (base 
ii  libc6                      2.2.5-3       GNU C Library: Shared libraries an
ii  libgcc1                    1:3.0.4-6     GCC support library.



-- 
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: