This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, libquadmath] PR47293 NAN not correctly read
- From: Jerry DeLisle <jvdelisle at frontier dot com>
- To: gfortran <fortran at gcc dot gnu dot org>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 26 Jan 2011 19:43:51 -0800
- Subject: [patch, libquadmath] PR47293 NAN not correctly read
Hi,
This patch is simple. The bit pattern for NAN was mixed up.
Regression tested on x86-64.
OK for trunk?
Jerry
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