This is the mail archive of the 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 RFC: Use explicit representation of infinity in VRP

Diego Novillo <> writes:

> Ian Lance Taylor wrote on 03/01/07 21:43:
> > Hmmm.  The code is correct.  uses_overflow_infinity means that TYPE is
> > an integer type which not wrap on overflow.  It returns true if we
> > want to use a special infinity to indicate that we've overflowed.
> > supports_overflow_infinity means that our particular representation of
> > overflow works for TYPE.  This is false for types for which
> > TYPE_{MIN,MAX}_VALUE is not a constant.  The problem is that we use
> > TREE_OVERFLOW to indicate an overflow, and that flag only exists for
> > constants.  So it is perfectly possible, even normal, to have types
> > which pass uses_overflow_infinity but not supports_overflow_infinity.
> > I originally used a more complex scheme with a hash table to handle
> > such types.  However, they are unusual--in fact I believe they only
> > occur for Ada.  So I have now opted for a simpler scheme in which we
> > just punt on signed overflow for that sort of type.
> > Any suggestions for better names for the two functions?
> How about changing uses_overflow_infinity to wraps_on_overflow_p?  The
> predicate has a different sign, so all the references to
> uses_overflow_infinity would have to be changed to !wraps_on_overflow_p

No, wraps_on_overflow_p isn't right.  Floating point types don't wrap
on overflow, but we don't want to use a special overflow indication
for them, since they already have one.  To reverse the sense of
uses_overflow_infinity we would need to test for "not an integral
type" || "wraps on overflow".  I don't see an easy name for that.

How about simply needs_overflow_infinity?


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