 <p>I find very strange the differences between the assembler results of the following code compiled without optimization and with -Os optimization.</p> <pre><code>#include &lt;stdio.h&gt; int main(){ int i; for(i=3;i&gt;2;i++); printf("%d\n",i); return 0; } </code></pre> <p>Without optimization the code results:</p> <pre><code>000000000040052d &lt;main&gt;: 40052d: 55 push %rbp 40052e: 48 89 e5 mov %rsp,%rbp 400531: 48 83 ec 10 sub $0x10,%rsp 400535: c7 45 fc 03 00 00 00 movl $0x3,-0x4(%rbp) 40053c: c7 45 fc 03 00 00 00 movl $0x3,-0x4(%rbp) 400543: eb 04 jmp 400549 &lt;main+0x1c&gt; 400545: 83 45 fc 01 addl $0x1,-0x4(%rbp) 400549: 83 7d fc 02 cmpl $0x2,-0x4(%rbp) 40054d: 7f f6 jg 400545 &lt;main+0x18&gt; 40054f: 8b 45 fc mov -0x4(%rbp),%eax 400552: 89 c6 mov %eax,%esi 400554: bf f4 05 40 00 mov $0x4005f4,%edi 400559: b8 00 00 00 00 mov $0x0,%eax 40055e: e8 ad fe ff ff callq 400410 &lt;printf@plt&gt; 400563: b8 00 00 00 00 mov $0x0,%eax 400568: c9 leaveq 400569: c3 retq </code></pre> <p>and the output is: -2147483648 (as I expect on a PC)</p> <p>With -Os the code results:</p> <pre><code>0000000000400400 &lt;main&gt;: 400400: eb fe jmp 400400 &lt;main&gt; </code></pre> <p>I think the second result is an error!!! I think the compiler should have compiled something corresponding to the code:</p> <p>printf("%d\n",-2147483648);</p>