This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Recent warning regression: no return statement in function returning non-void


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

Also if you make the function static inline, older GCC versions will
trigger same warning.
The problem here is that original code was relying on the fact that
extern inline and static inline functions was only functions that was
ever removed and not compiled.  THis is not true since GCC 3.4 when
callgraph code started to elliminate all static functions.  

Honza
> 
> Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]