public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@frontier.com>
To: gfortran <fortran@gcc.gnu.org>
Cc: gcc patches <gcc-patches@gcc.gnu.org>
Subject: [patch, libquadmath] PR47293 NAN not correctly read
Date: Thu, 27 Jan 2011 04:49:00 -0000	[thread overview]
Message-ID: <4D40E9F7.4090206@frontier.com> (raw)

[-- 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

             reply	other threads:[~2011-01-27  3:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27  4:49 Jerry DeLisle [this message]
2011-01-27 20:20 ` Jakub Jelinek
2011-01-29 23:16   ` Jerry DeLisle
2011-02-01  2:31     ` Jerry DeLisle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D40E9F7.4090206@frontier.com \
    --to=jvdelisle@frontier.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).