Patchwork [libquadmath] PR47293 NAN not correctly read

login
register
mail settings
Submitter Jerry DeLisle
Date Jan. 29, 2011, 7:13 p.m.
Message ID <4D4466C0.3040800@frontier.com>
Download mbox | patch
Permalink /patch/80962/
State New
Headers show

Comments

Jerry DeLisle - Jan. 29, 2011, 7:13 p.m.
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
Jerry DeLisle - Feb. 1, 2011, 2:31 a.m.
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

Patch

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