<p><pre><code>  titan:&#x2F;tmp geofft$ cc -O3 -c test.c
</code></pre>
Is your use of &#x27;cc&#x27; instead of &#x27;gcc&#x27; intentional here?  It implies that all compilers make this &quot;optimization&quot;, but I think it&#x27;s currently only GCC.   ICC, Clang, and MSVC continue to work that way that the programmer intended: Godbolt for ICC and Clang <a href="http:&#x2F;&#x2F;goo.gl&#x2F;jFfvyz" rel="nofollow">http:&#x2F;&#x2F;goo.gl&#x2F;jFfvyz</a>, MSVC <a href="http:&#x2F;&#x2F;webcompiler.cloudapp.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;webcompiler.cloudapp.net&#x2F;</a>.<p>While it would be unwise to rely on this &quot;polite&quot; behavior from a compiler, I find it difficult to argue that GCC does a <i>better</i> job of compiling this particular code.  But perhaps the speedup on similar code is enough to justify the occasional insidious bug?<p>It would be nice if there was a GCC option that produced a warning here.  Is there one?