This is the mail archive of the gcc@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


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 this program does not involve undefined behavior, because the 
increment happens in type int and then implementation-defined behavior 
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 regressions.

-- 
Joseph S. Myers
joseph@codesourcery.com

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