On 06/19/11 23:35, Ralf Wildenhues wrote: > If you don't use volatile, the compiler is pretty much free to give you > whatever answer it likes today.
It's true that the test relies on undefined behavior, and so the compiler is free to do whatever it wants, but I don't see how adding "volatile" helps, for this particular test. Whatever reasoning the compiler can do without "volatile", it can also do with "volatile", for this test. (I have more confidence in the revised test, because this time I actually ran it on an x86-64 host with GCC 4.6.0. :-)