This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Recent warning regression: no return statement in function returning non-void
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Gerald Pfeifer" <gerald at pfeifer dot com>
- Cc: gcc at gcc dot gnu dot org, "Jan Hubicka" <jh at suse dot cz>
- Date: Sun, 27 Jul 2008 13:32:49 +0200
- Subject: Re: Recent warning regression: no return statement in function returning non-void
- References: <alpine.LSU.1.10.0807271309400.8835@acrux.dbai.tuwien.ac.at>
On Sun, Jul 27, 2008 at 1:18 PM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> I believe the following happened in the last 48 or so hours; I saw
> this triggered by my nightly Wine builds which in turn use my nightly
> GCC builds. ;-)
>
> For code like the following where we have an infinite loop in a
> non-void function, we now (incorrectly) issue a warning with all
> of -O0, -O1 and -O2 whereas previously we would not:
>
> void g();
>
> int f() {
> for(;;)
> g();
> }
>
> % gccvs -c -Wall x.c
> x.c: In function 'int f()':
> x.c:6: warning: no return statement in function returning non-void
I think the warning is perfectly correct. There is no return statement
in that function and it does return non-void. The warning doesn't say
that the function does return without a value.
Richard.