public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3195] The true side of x != x should set NAN.
@ 2022-10-10 12:50 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-10-10 12:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:69988cd58becc115b236f88627fe92436baaa674

commit r13-3195-g69988cd58becc115b236f88627fe92436baaa674
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Mon Oct 10 11:15:43 2022 +0200

    The true side of x != x should set NAN.
    
    gcc/ChangeLog:
    
            * range-op-float.cc (foperator_not_equal::op1_range): Set NAN on
            TRUE side for x != x.

Diff:
---
 gcc/range-op-float.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index 91833d3f855..5ffe38da53a 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -497,14 +497,17 @@ bool
 foperator_not_equal::op1_range (frange &r, tree type,
 				const irange &lhs,
 				const frange &op2,
-				relation_kind) const
+				relation_kind rel) const
 {
   switch (get_bool_state (r, lhs, type))
     {
     case BRS_TRUE:
+      // The TRUE side of op1 != op1 implies op1 is NAN.
+      if (rel == VREL_EQ)
+	r.set_nan (type);
       // If the result is true, the only time we know anything is if
       // OP2 is a constant.
-      if (op2.singleton_p ())
+      else if (op2.singleton_p ())
 	{
 	  // This is correct even if op1 is NAN, because the following
 	  // range would be ~[tmp, tmp] with the NAN property set to

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-10 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-10 12:50 [gcc r13-3195] The true side of x != x should set NAN 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).