Or the compiler can unroll the loop completely, meaning that there is never even a register used for the loop counter. All sorts of strange things happen when you start relying on undefined behavior :)
Originally Posted by iMalc
I'm not sure what you mean by undefined behavior. The code will operate precisely as written in the source, although the compiler may do all kinds of things that preserve that exact operation. For instance, if you take the address of a variable, it suddenly must actually exist (otherwise it could not have an address).
Originally Posted by KCfromNC
In other words, don't worry about what the compiler may or may not be doing. The compiler will ensure that the behavior is as you intended. All this under the hood stuff only matters when you go off the reservation in some OTHER way, such as trying to access a variable which has gone out of scope.