* [COMMITTED] Handle NANs in frange::operator== [PR109593]
@ 2023-04-23 9:04 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2023-04-23 9:04 UTC (permalink / raw)
To: GCC patches; +Cc: Andrew MacLeod, Aldy Hernandez
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-23 9:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-23 9:04 [COMMITTED] Handle NANs in frange::operator== [PR109593] Aldy Hernandez
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).