basic VRP min/max range overflow question

Robert Dewar dewar@adacore.com
Sat Jun 18 02:02:00 GMT 2005


Paul Schlie wrote:

>   (As there's nothing in the standard which enables an implementation
>   to subsequently disregard the resulting value of an implementation
>   specific operation from the best I can tell; although would welcome
>   someone pointing out where specifically it's allowed.  As unless
>   it is, an undefined result is specific to the just that operation.
>   It does not magically alter the semantics well defined operations
>   which may utilize that result, regardless of it's value.)
> 
>   ["undefined" only provides liberties within the constrains of what
>   is specifically specified as being undefined, but none beyond that.]

You are forgetting the "as if" semantics that is always inherent in
the standard. So after an operation with an undefined result, we can
do anything we like with the value, since it is "as if" the operation
had produced that value. So for example, if we skip an operation because
we know it will overflow, and end up using uninitialized junk in a register,
it is "as if" that undefined operation produced the particular uninitialized
junk value that we ended up with.

So the above is inventive but wrong.






More information about the Gcc mailing list