This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Patch for gcc.c-torture/execute/ieee/20010226-1.c
- From: "D.Venkatasubramanian, Noida" <dvenkat at noida dot hcltech dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Fergus Henderson <fjh at cs dot mu dot oz dot au>, Manfred Hollstein <manfredh at redhat dot com>, Richard dot Earnshaw at arm dot com, gcc-patches at gcc dot gnu dot org, "'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Tue, 24 Sep 2002 20:21:36 +0530
- Subject: RE: Patch for gcc.c-torture/execute/ieee/20010226-1.c
Hi,
>The correct solution is
>
> #include <float.h>
>
> if (LDBL_EPSILON > 0x1p-31L)
> return 0;
>
>since we look at 32 bits of the significand.
Thanks a lot for the suggestion!
I think then, that this patch should suffice :-).
Thanks and Regards,
Venky
Entry for Change Log
Mon Sep 23 15:50:51 IST 2002 D.Venkatasubramanian
<dvenkat@noida.hcltech.com>
* gcc.c-torture/execute/20010226-1.c (main): If double isn't at
least
greater than 4 bytes, the test case should exit, since, 4 byte
doubles
do not have enough significand bits for the test case to complete
successfully.
*** gcc.c-torture/execute/ieee/20010226-1.c Fri Aug 16 15:48:14 2002
--- 20010226-1.c.modified Tue Sep 24 20:26:33 2002
***************
*** 1,3 ****
--- 1,4 ----
+ #include "float.h"
long double dfrom = 1.1;
long double m1;
long double m2;
*************** int main( )
*** 7,15 ****
{
m1 = dfrom / 2.0;
m2 = m1 * 4294967296.0;
mant_long = ((unsigned long) m2) & 0xffffffff;
-
if ( mant_long == 0x8ccccccc)
exit (0);
else
--- 8,21 ----
{
m1 = dfrom / 2.0;
+ /* Some targets may not support double precision floating point
arithmetic,
+ * this test case should pass for such targets. */
+
+ if (LDBL_EPSILON > 0x1p-31L)
+ return 0;
+
m2 = m1 * 4294967296.0;
mant_long = ((unsigned long) m2) & 0xffffffff;
if ( mant_long == 0x8ccccccc)
exit (0);
else
-----Original Message-----
From: Richard Henderson [mailto:rth@redhat.com]
Sent: Tuesday, September 24, 2002 2:53 AM
To: D.Venkatasubramanian, Noida
Cc: Fergus Henderson; Manfred Hollstein; Richard.Earnshaw@arm.com;
gcc-patches@gcc.gnu.org; 'gcc@gcc.gnu.org'
Subject: Re: Patch for gcc.c-torture/execute/ieee/20010226-1.c
On Mon, Sep 23, 2002 at 07:48:00PM +0530, D.Venkatasubramanian, Noida wrote:
> The other solution,
> if (sizeof(long double) <= 4 && ((unsigned char)-1) == 255)
> exit (0);
>
> would again make it specific, something we are trying to avoid, isn't it
;-)
The correct solution is
#include <float.h>
if (LDBL_EPSILON > 0x1p-31L)
return 0;
since we look at 32 bits of the significand.
r~