Gcc silently transforms a finite loop to an infinite one

Michael Matz matz@suse.de
Tue Nov 29 19:20:00 GMT 2011


On Tue, 29 Nov 2011, Robert Dewar wrote:

> > > IMHO it would be better to issue a warning when a finite loop is 
> > > transformed to an infinite one (as a result of -ftree-vrp).
> >
> > -Wstrict-overflow gives a warning in this program.  This warning isn't 
> > active by default.  4.1 didn't yet have this warning IIRC.
> I would tend to agree that when this transformation is applied, an 
> unconditional warning is appropriate. It's almost certainly indicative 
> of a bug,

Yes, well.  The problem is, this particular warning is in fairly generic 
code that triggers often in harmless situations, i.e. generates quite a 
number false positives :-/

> and indeed the character case of this report is such a common case that 
> I would look for it specifically and diagnose it (and preferably make it 
> "work").


More information about the Gcc-help mailing list