This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Gcc silently transforms a finite loop to an infinite one
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Nadezhda Ivanоvna Vyukova <niva at niisi dot msk dot ru>
- Cc: gcc at gnu dot org
- Date: Tue, 29 Nov 2011 15:44:28 +0000 (UTC)
- Subject: Re: Gcc silently transforms a finite loop to an infinite one
- References: <1322566691.2994.43.camel@ab02>
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