[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: strange warnings
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 9 Jun 2011 13:48:30 -0300
> Roberto Ierusalimschy wrote:
> > When compiling Lua 5.1.4 with gcc (version 4.4.3) with option
> > -Wstrict-overflow=2, I get two warnings that I cannot understand:
> > lvm.c: In function ‘luaV_concat’:
> > lvm.c:300: warning: assuming signed overflow does not occur when simplifying conditional to constant
> GCC deduces that n >= 1 from scalar evolution analysis earlier in
> line 293. SCEV assumes that n++ does not overflow. You get the
> warning in line 300 because the loop entry condition has been
> eliminated based on SCEV and VRP (value range propagation).
I thought about that, but it seems very strange (I would call it a bug)
to give a warning about code that the compiler itself created. The
written code (the only one of concern to warnings) does not have a
separated loop entry condition; the only condition it does have is not
> You can disable specific warnings with pragmas in more recent GCC
> versions. Since the assumptions of the compiler are in fact
> correct in this case, you can just ignore the warnings.
I do not know a practical way to ignore the warnings. Each time the
compiler gives the warnings I have to check them and distinguish between
those "expected" and new ones.