On 16 January 2012 21:27, Michel Fortin <michel.fortin@michelf.com> wrote:
In fact, the optimization I'd expect the compiler to do in this case is just wipe out all the code, as it does nothing other than putting a value in a local variable which is never reused later.

Yes, my first thought when I saw this test was "why is it generating any code at all?".. But I tried to forget about that :)
I am curious though, what is causing that code (on both sides) to not be eliminated? If I write that in C, I'm sure it would generate nothing. Is this a language implementation bug somehow?