Gcc silently transforms a finite loop to an infinite one
Joseph S. Myers
joseph@codesourcery.com
Tue Nov 29 21:53:00 GMT 2011
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
More information about the Gcc
mailing list