> From: Paul Koning <[EMAIL PROTECTED]>
>>>>>> "Paul" == Paul Schlie <[EMAIL PROTECTED]> writes:
>>> From: Robert Dewar <[EMAIL PROTECTED]>
>>>> 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.
> 
>  Paul> I don't contest that it may, I simply don't believe it should.
> 
> In that case you may want to stick with -O0.  There are *lots* of
> things GCC does that alter undefined cases.  How about the undefined
> behavior when aliasing rules are violated?  Would you want to make
> -fno-strict-aliasing be the only supported setting?

- Isn't the purpose of "restrict" to explicitly enable the compiler to
  more aggressively optimize references which it may be not have been
  able to identify it as being strictly safe?  (As opposed to it feeling
  compelled presume potentially disastrously otherwise, without explicit
  permission to do so?)


Reply via email to