This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/50922] infinite loop when optimized
- From: "mikpe at it dot uu.se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 30 Oct 2011 17:03:10 +0000
- Subject: [Bug c/50922] infinite loop when optimized
- Auto-submitted: auto-generated
- References: <bug-50922-4@http.gcc.gnu.org/bugzilla/>
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.