public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] frange::maybe_isnan() should return FALSE for undefined ranges.
@ 2022-09-20 18:22 Aldy Hernandez
  2022-09-21  7:38 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Aldy Hernandez @ 2022-09-20 18:22 UTC (permalink / raw)
  To: GCC patches; +Cc: Andrew MacLeod, Aldy Hernandez

Undefined ranges have undefined NAN bits.  We can't depend on them,
as they may contain garbage.  This patch returns false from
maybe_isnan() for undefined ranges (the empty set).

gcc/ChangeLog:

	* value-range.h (frange::maybe_isnan): Return false for
	undefined ranges.
---
 gcc/value-range.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/value-range.h b/gcc/value-range.h
index 7d5584a9294..325ed08f290 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1210,6 +1210,8 @@ frange::known_isinf () const
 inline bool
 frange::maybe_isnan () const
 {
+  if (undefined_p ())
+    return false;
   return m_pos_nan || m_neg_nan;
 }
 
-- 
2.37.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-21  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-20 18:22 [COMMITTED] frange::maybe_isnan() should return FALSE for undefined ranges Aldy Hernandez
2022-09-21  7:38 ` Richard Biener
2022-09-21  7:52   ` Aldy Hernandez
2022-09-21  9:36     ` Richard Biener

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).