This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: basic VRP min/max range overflow question
- From: Paul Schlie <schlie at comcast dot net>
- To: Diego Novillo <dnovillo at redhat dot com>
- Cc: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>,GCC Development <gcc at gcc dot gnu dot org>
- Date: Fri, 17 Jun 2005 20:20:31 -0400
- Subject: Re: basic VRP min/max range overflow question
> From: Diego Novillo <dnovillo@redhat.com>
> On Fri, Jun 17, 2005 at 02:28:58PM -0400, Paul Schlie wrote:
>
>> int x;
>> volatile int v;
>>
>> x = (v ? 0 : INT_MAX) + 1; // [1, INT_MAX] (without -fwrapv)
>>
>> if (x <= 0) // Which may be erroneously
>> printf("%i is <= 0.", x); // optimized away, with this.
>> else
>> printf("%i is > 0.", x); // Leaving only this in error.
>>
> You want to file a DR with the language standards.
- There's nothing wrong with the standard, just it's implementation.
(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.]