public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrew Macleod <amacleod@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-1634] Fix floating point bug in fold_range.
Date: Thu,  8 Jun 2023 18:57:22 +0000 (GMT)	[thread overview]
Message-ID: <20230608185722.7175A3858C20@sourceware.org> (raw)

https://gcc.gnu.org/g:ce81740c44c07a82a0839fa8c08a0a51a72c5cfe

commit r14-1634-gce81740c44c07a82a0839fa8c08a0a51a72c5cfe
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Wed Jun 7 14:03:35 2023 -0400

    Fix floating point bug in fold_range.
    
    We currently do not have any floating point operators where operand 1 is
    a different type than the LHS. When we eventually do there is a bug
    in fold_range. If either operand is a known NAN, it returns a NAN
    of the type of operand 1 instead of the result type.
    
            * range-op-float.cc (range_operator_float::fold_range): Return
            NAN of the result type.

Diff:
---
 gcc/range-op-float.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index a99a6b01ed8..af598b60a79 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -57,7 +57,7 @@ range_operator_float::fold_range (frange &r, tree type,
     return true;
   if (op1.known_isnan () || op2.known_isnan ())
     {
-      r.set_nan (op1.type ());
+      r.set_nan (type);
       return true;
     }

                 reply	other threads:[~2023-06-08 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230608185722.7175A3858C20@sourceware.org \
    --to=amacleod@gcc.gnu.org \
    --cc=gcc-cvs@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).