From: Jakub Jelinek Date: Tue, 18 Feb 2003 23:43:55 +0000 (+0100) Subject: real.c (asctoeg): Handle denormals in hexadecimal notation. X-Git-Tag: releases/gcc-3.2.3~189 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b74899f7f3c7f0c93d3ae69c743ca4abf9e6f9db;p=thirdparty%2Fgcc.git real.c (asctoeg): Handle denormals in hexadecimal notation. * real.c (asctoeg): Handle denormals in hexadecimal notation. * gcc.dg/20030217-1.c: New test. From-SVN: r63069 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c68c1540575..130ed83b3f7c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2003-02-18 Jakub Jelinek + + * real.c (asctoeg): Handle denormals in hexadecimal notation. + 2003-02-16 Arend Bayer Richard Henderson diff --git a/gcc/real.c b/gcc/real.c index 7b8879b87646..1dcd5492344b 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -5417,7 +5417,12 @@ read_expnt: if (lexp > 0x7fff) goto infinite; if (lexp < 0) - goto zero; + { + if (lexp < -NBITS) + goto zero; + lost |= eshift (yy, lexp); + lexp = 0; + } yy[E] = lexp; goto expdon; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ad51e68dede..50bfe987edf8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-02-18 Jakub Jelinek + + * gcc.dg/20030217-1.c: New test. + 2003-02-10 Eric Botcazou Christian Ehrhardt diff --git a/gcc/testsuite/gcc.dg/20030217-1.c b/gcc/testsuite/gcc.dg/20030217-1.c new file mode 100644 index 000000000000..d0cd91316c40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/20030217-1.c @@ -0,0 +1,18 @@ +/* Test whether denormal floating point constants in hexadecimal notation + are parsed correctly. */ +/* { dg-do run { target i?86-*-linux* x86_64-*-* } } */ +/* { dg-options "-std=c99" } */ + +long double d = 0x0.0000003ffffffff00000p-16357L; +long double e = 0x0.0000003ffffffff00000p-16356L; + +extern void abort (void); +extern void exit (int); + +int +main (void) +{ + if (d != e / 2.0) + abort (); + exit (0); +}