Gcc silently transforms a finite loop to an infinite one
Michael Matz
matz@suse.de
Tue Nov 29 14:55:00 GMT 2011
Hi,
please use gcc-help@ for this type of questions.
On Tue, 29 Nov 2011, Nadezhda Ivanоvna Vyukova wrote:
> I've explained the customer that by default char is treated
> as signed char on our platform and therefore this program
> does not conform ISO C90, as it causes the integer overflow
> (undefined behavior).
That is correct.
> But he was not satisfied.
> He argued that the program compiled with gcc-3.4.6 behaves
> "correctly" and now the compiler silently produces an
> incomprehensible code.
There is no "correct" with undefined code. He simply was lucky with 3.4.
> 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.
Ciao,
Michael.
More information about the Gcc-help
mailing list