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: Bug in real.c rewrite


On Tue, Feb 25, 2003 at 10:45:13AM -0800, Richard Henderson wrote:
> On Mon, Feb 24, 2003 at 05:33:01PM -0700, law at redhat dot com wrote:
> >   if (((unsigned long long int)((float) ~((~0ULL) >> 1))) != 
> > 0x8000000000000000ULL)
> 
> Not a bug in real.c; fold_convert is failing to mention
> that we're converting back to *unsigned* LL.  I'll work
> on a fix.

Ho hum.  There actually _isn't_ a way to indicate signed or unsigned
during the conversion.

I recall now that this form of overflow is something that Alan Modra
talked me into at the time.  I'm now thinking that this is more trouble
that it's worth, trying to force a particular result for a value that's
technically undefined.  So I've reverted the change.


r~


        * real.c (real_to_integer2): Force overflow result only for 
        unsigned overflow.

Index: real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.109
diff -c -p -d -u -r1.109 real.c
--- real.c	27 Jan 2003 06:23:32 -0000	1.109
+++ real.c	25 Feb 2003 21:33:58 -0000
@@ -1371,7 +1371,7 @@ real_to_integer2 (plow, phigh, r)
       exp = r->exp;
       if (exp <= 0)
 	goto underflow;
-      if (exp >= 2*HOST_BITS_PER_WIDE_INT)
+      if (exp > 2*HOST_BITS_PER_WIDE_INT)
 	goto overflow;
 
       rshift_significand (&t, r, 2*HOST_BITS_PER_WIDE_INT - exp);


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