Paul Schlie wrote:

What about optimising x*2/2 to x?


Given that "C" requires the above be evaluated as (x*2)/2, as the language
specifies that the syntax defines the precedence of the operations, and that
no optimization should alter the behavior as specified by the program; I'd
say that unless it was known that the value range of x was between 0
and INT_MAX, the optimization is simply invalid.

the optimization is indeed valid

optimizations may most certainly alter behavior of undefined
code. think about uninitialized local variables.

Reply via email to