Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Nadezhda Ivanоvna Vyukova
Hello, members of GCC development team! I am involved in support of customers who use GCC. Recently a customer has complaint that gcc-4.1.2 generates an infinite loop for the following program: #include stdio.h extern void f (int); int main () { char e = 0; do { printf

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Michael Matz
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

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Robert Dewar
On 11/29/2011 8:29 AM, Michael Matz 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

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Ian Lance Taylor
Nadezhda Ivanоvna Vyukova n...@niisi.msk.ru writes: I am involved in support of customers who use GCC. Recently a customer has complaint that gcc-4.1.2 generates an infinite loop for the following program: #include stdio.h extern void f (int); int main () { char e = 0; do

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread David Brown
On 29/11/2011 15:25, Ian Lance Taylor wrote: Nadezhda Ivanоvna Vyukovan...@niisi.msk.ru writes: I am involved in support of customers who use GCC. Recently a customer has complaint that gcc-4.1.2 generates an infinite loop for the following program: #includestdio.h extern void f (int);

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Michael Matz
Hi, 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

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Joseph S. Myers
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). But he was not satisfied. Actually

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread David Brown
On 29/11/11 16:44, Joseph S. Myers wrote: 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

Re: Gcc silently transforms a finite loop to an infinite one

2011-11-29 Thread Joseph S. Myers
On Tue, 29 Nov 2011, David Brown wrote: On 29/11/11 16:44, Joseph S. Myers wrote: converting the int to char (which GCC defines as modulo) applies. See PR 35634 which has various discussion of possible approaches for fixing this, and patches that introduce vectorizer optimization