In a strict sense the compiler compiles a translation unit it into an object form - and may not (doesn't have a right to) change any observable logic.
Ignoring the specific case in question this statement is wrong as a generalisation.
For instance the compiler is required to change the constant 0 when used in a pointer context into the platforms representation of the NULL pointer, which note is not required to be all bits 0.
The compiler is specificly required to change the observable logic in just the way you have claimed it has no right to.