This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [New testcase] Wrong: "warning: `noreturn' function does return"
- To: aj at suse dot de, rth at cygnus dot com
- Subject: Re: [New testcase] Wrong: "warning: `noreturn' function does return"
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 8 May 2000 22:43:54 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org
> From: Andreas Jaeger <aj@suse.de>
>
> This small program:
> extern void abort (void) __attribute__ ((__noreturn__));
>
> void noreturn (int x) __attribute__ ((__noreturn__));
>
> void
> noreturn (int x)
> {
> abort ();
> }
>
> generates a warning with the current CVS gcc version on i686-linux-gnu
> if compiled with:
>
> /opt/gcc-2.96.test/bin/gcc -c noreturn.c -O3 -Wall
> noreturn.c: In function `noreturn':
> noreturn.c:11: warning: `noreturn' function does return
>
> There's no warning with -O2 - and no test for this in the testsuite so
> far. I've noticed the warnings in testing glibc first where we use a
> number of noreturn attributes.
>
> I'd like to put this patch into the testsuite. Ok, to commit?
>
> Andreas
>
> 2000-05-04 Andreas Jaeger <aj@suse.de>
>
> * gcc.dg/noreturn-2.c: New test.
>
> /* Check for invalid "noreturn" warning. */
> /* { dg-do compile } */
> /* { dg-options "-O3 -Wall" } */
> extern void abort (void) __attribute__ ((__noreturn__));
>
> void noreturn (int x) __attribute__ ((__noreturn__));
>
> void
> noreturn (int x)
> {
> abort ();
> }
>
> --
> Andreas Jaeger
> SuSE Labs aj@suse.de
Is there a way to make a gcc.dg test cycle through -O# options? I
believe the noreturn-1.c test does something similar to the above
except that it only does it for -O2. Given that recent optimization
work broke the noreturn stuff badly, but breakage only occurs at
specific levels, I'd like to be able to cycle these tests like the
gcc.c-torture tests do and check various opt levels from 0 to 3.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions