@Syndacate: I don't know why you keep saying you write nothing of optimization when you write this:
(Emphasis mine.) What else do you think that is, other than a compiler cheating (i.e., doing something it is specifically forbidden by the standard to do for the sake of saving time)?I mean sure, you can put a volatile keyword there as you did, and there's the possibility that it changes between checks, but the likelihood of a context switch occurring between checking two variables is almost 0 - and I'm sure that on some compilations it probably is 0 simply due to the way the compiler resolves the logic for the jump command itself.
(ETA: And in terms of volatile, most people don't see memory-mapped i/o a la http://en.wikipedia.org/wiki/Duff%27s_device anymore but you can find that the act of reading a volatile variable is actually what changes its value.)