This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: basic VRP min/max range overflow question


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.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]