[Bug c/50922] infinite loop when optimized
mikpe at it dot uu.se
gcc-bugzilla@gcc.gnu.org
Sun Oct 30 17:03:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50922
--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2011-10-30 17:03:10 UTC ---
(In reply to comment #0)
> int main(void)
> {
> long x=0;
> unsigned long c;
> for(c=0;c<2147483648UL;c++)
> {
> lcdSendData(x++);
> }
You're causing a signed overflow in the "x++" expression. Try making x
"unsigned long" instead. Or pass "-fwrapv" to gcc.
More information about the Gcc-bugs
mailing list