Message ID | 4D40E9F7.4090206@frontier.com |
---|---|
State | New |
Headers | show |
On Wed, Jan 26, 2011 at 07:43:51PM -0800, Jerry DeLisle wrote: > This patch is simple. The bit pattern for NAN was mixed up. 1) It should be 0x7fff8000 instead of 0xffff8000 2) the code will handle endianess incorrectly case STRTOG_NaN: L[0] = ld_QNAN0; L[1] = ld_QNAN1; L[2] = ld_QNAN2; L[3] = ld_QNAN3; should be L[_3] = ld_QNAN0; L[_2] = ld_QNAN1; L[_1] = ld_QNAN2; L[_0] = ld_QNAN3; > 2011-01-26 Jerry DeLisle <jvdelisle@gcc.gnu.org> > > PR libquadmath/47293 > * gdtoa/qd_qnan.h: Fix NAN bit pattern. > ! { dg-do run } > ! PR47293 NAN not correctly read > character(len=200) :: str > real(16) :: r, x, y, z > integer(16) :: k1, k2 > x = 0.0 > y = 0.0 > r = 1.0 > str = 'NAN' ; read(str,*) r > z = x/y > k1 = transfer(z,k1) > k2 = transfer(r,k2) > if (k1.ne.k2) call abort > end > Index: gd_qnan.h > =================================================================== > --- gd_qnan.h (revision 169141) > +++ gd_qnan.h (working copy) > @@ -2,9 +2,9 @@ > #define d_QNAN0 0x0 > #define d_QNAN1 0xfff80000 > #define ld_QNAN0 0x0 > -#define ld_QNAN1 0xc0000000 > -#define ld_QNAN2 0xffff > -#define ld_QNAN3 0x0 > +#define ld_QNAN1 0x0 > +#define ld_QNAN2 0x0 > +#define ld_QNAN3 0xffff8000 > #define ldus_QNAN0 0x0 > #define ldus_QNAN1 0x0 > #define ldus_QNAN2 0x0 Jakub
Index: gd_qnan.h =================================================================== --- gd_qnan.h (revision 169141) +++ gd_qnan.h (working copy) @@ -2,9 +2,9 @@ #define d_QNAN0 0x0 #define d_QNAN1 0xfff80000 #define ld_QNAN0 0x0 -#define ld_QNAN1 0xc0000000 -#define ld_QNAN2 0xffff -#define ld_QNAN3 0x0 +#define ld_QNAN1 0x0 +#define ld_QNAN2 0x0 +#define ld_QNAN3 0xffff8000 #define ldus_QNAN0 0x0 #define ldus_QNAN1 0x0 #define ldus_QNAN2 0x0