On 08/11/15 19:34, Segher Boessenkool wrote: > The compiler is free to transform it to > > int foo(int x) { > int t = x*x*x; > if (x > 1290) { > printf("X is wrong here %d, but we don't care\n", x); > } > return t; > } > > because x*x*x does not have any observable behaviour, and then it is > obvious it _can_ remove the printf and conditional. Yes, that is correct. And, indeed, the hardware is free to do taht too. With speculative execution, the "as if" rule is not limited to the compiler. Andrew.