From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [COMMITTED] Handle NANs in frange::operator== [PR109593]
Date: Sun, 23 Apr 2023 11:04:53 +0200 [thread overview]
Message-ID: <20230423090453.87556-1-aldyh@redhat.com> (raw)
This patch...
commit 10e481b154c5fc63e6ce4b449ce86cecb87a6015
Return true from operator== for two identical ranges containing NAN.
removed the check for NANs, which caused us to read from m_min and
m_max which are undefined for NANs.
gcc/ChangeLog:
PR tree-optimization/109593
* value-range.cc (frange::operator==): Handle NANs.
---
gcc/value-range.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 17f4e1b9f59..97162413727 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -682,6 +682,16 @@ frange::operator== (const frange &src) const
if (varying_p ())
return types_compatible_p (m_type, src.m_type);
+ bool nan1 = known_isnan ();
+ bool nan2 = src.known_isnan ();
+ if (nan1 || nan2)
+ {
+ if (nan1 && nan2)
+ return (m_pos_nan == src.m_pos_nan
+ && m_neg_nan == src.m_neg_nan);
+ return false;
+ }
+
return (real_identical (&m_min, &src.m_min)
&& real_identical (&m_max, &src.m_max)
&& m_pos_nan == src.m_pos_nan
--
2.40.0
reply other threads:[~2023-04-23 9:05 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=20230423090453.87556-1-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--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).