* [patch, libquadmath] PR47293 NAN not correctly read
@ 2011-01-27 4:49 Jerry DeLisle
2011-01-27 20:20 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Jerry DeLisle @ 2011-01-27 4:49 UTC (permalink / raw)
To: gfortran; +Cc: gcc patches
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
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.
[-- Attachment #2: nan_7.f90 --]
[-- Type: text/x-fortran, Size: 249 bytes --]
! { 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
[-- Attachment #3: pr47293.diff --]
[-- Type: text/x-patch, Size: 454 bytes --]
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch, libquadmath] PR47293 NAN not correctly read
2011-01-27 4:49 [patch, libquadmath] PR47293 NAN not correctly read Jerry DeLisle
@ 2011-01-27 20:20 ` Jakub Jelinek
2011-01-29 23:16 ` Jerry DeLisle
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2011-01-27 20:20 UTC (permalink / raw)
To: Jerry DeLisle; +Cc: gfortran, gcc patches
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch, libquadmath] PR47293 NAN not correctly read
2011-01-27 20:20 ` Jakub Jelinek
@ 2011-01-29 23:16 ` Jerry DeLisle
2011-02-01 2:31 ` Jerry DeLisle
0 siblings, 1 reply; 4+ messages in thread
From: Jerry DeLisle @ 2011-01-29 23:16 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gfortran, gcc patches
[-- Attachment #1: Type: text/plain, Size: 713 bytes --]
On 01/27/2011 11:42 AM, Jakub Jelinek wrote:
> 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;
>
Here is an updated patch. I will submit a change to the testsuite separately.
OK for trunk?
Jerry
[-- Attachment #2: pr47293-2.diff --]
[-- Type: text/x-patch, Size: 1035 bytes --]
Index: strtopQ.c
===================================================================
--- strtopQ.c (revision 169374)
+++ strtopQ.c (working copy)
@@ -92,10 +92,10 @@
break;
case STRTOG_NaN:
- L[0] = ld_QNAN0;
- L[1] = ld_QNAN1;
- L[2] = ld_QNAN2;
- L[3] = ld_QNAN3;
+ L[_0] = ld_QNAN3;
+ L[_1] = ld_QNAN2;
+ L[_2] = ld_QNAN1;
+ L[_3] = ld_QNAN0;
}
if (k & STRTOG_Neg)
L[_0] |= 0x80000000L;
Index: gd_qnan.h
===================================================================
--- gd_qnan.h (revision 169374)
+++ gd_qnan.h (working copy)
@@ -1,12 +1,12 @@
-#define f_QNAN 0xffc00000
+#define f_QNAN 0x7fc00000
#define d_QNAN0 0x0
-#define d_QNAN1 0xfff80000
+#define d_QNAN1 0x7ff80000
#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 0x7fff8000
#define ldus_QNAN0 0x0
#define ldus_QNAN1 0x0
#define ldus_QNAN2 0x0
#define ldus_QNAN3 0xc000
-#define ldus_QNAN4 0xffff
+#define ldus_QNAN4 0x7fff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch, libquadmath] PR47293 NAN not correctly read
2011-01-29 23:16 ` Jerry DeLisle
@ 2011-02-01 2:31 ` Jerry DeLisle
0 siblings, 0 replies; 4+ messages in thread
From: Jerry DeLisle @ 2011-02-01 2:31 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gfortran, gcc patches
On 01/29/2011 11:13 AM, Jerry DeLisle wrote:
> On 01/27/2011 11:42 AM, Jakub Jelinek wrote:
>> 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;
>>
>
> Here is an updated patch. I will submit a change to the testsuite separately.
>
> OK for trunk?
Sending ChangeLog
Sending gdtoa/gd_qnan.h
Sending gdtoa/strtopQ.c
Transmitting file data ...
Committed revision 169466.
Committed under obvious rule.
Jerry
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-01 2:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 4:49 [patch, libquadmath] PR47293 NAN not correctly read Jerry DeLisle
2011-01-27 20:20 ` Jakub Jelinek
2011-01-29 23:16 ` Jerry DeLisle
2011-02-01 2:31 ` Jerry DeLisle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).