This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Gcc silently transforms a finite loop to an infinite one
- From: Michael Matz <matz at suse dot de>
- To: Nadezhda Ivanоvna Vyukova <niva at niisi dot msk dot ru>
- Cc: gcc at gnu dot org, gcc-help at gnu dot org
- Date: Tue, 29 Nov 2011 14:29:47 +0100 (CET)
- Subject: Re: Gcc silently transforms a finite loop to an infinite one
- References: <1322566691.2994.43.camel@ab02>
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.