This is the mail archive of the gcc-help@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: Gcc silently transforms a finite loop to an infinite one


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.

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