This is the mail archive of the gcc-patches@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: [patch] VRP miscompiles crafty


Hi,

On Mon, 11 Sep 2005, Geoffrey Keating wrote:

> Although it's pretty clear that 0 - (-Inf) should be +Inf, I'm a bit
> confused by how the code got to this point.  The expression '0 - (-Inf)'
> does not overflow in itself;

It does.  -INF == MIN_INT == -2147483648 (or rather TYPE_MIN_VALUE, but 
you get the idea).  And the negative of that is not representable in the 
same type, hence an overflow occurs when producing it.  +INF is 
TYPE_MAX_VALUE which is not -TYPE_MIN_VALUE.  Remember that we use normal 
integers to represent -+INF, not any exceptional value, and normal integer 
arithmetic (int_const_binop) to calculate with them.


Ciao,
Michael.


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