[gcc r14-1189] Hash known NANs correctly for franges.

Aldy Hernandez aldyh@gcc.gnu.org
Thu May 25 05:34:34 GMT 2023


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

commit r14-1189-gcd64ba5a7265b5733da6b54cf72b726113dd68d8
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Wed May 24 19:53:53 2023 +0200

    Hash known NANs correctly for franges.
    
    We're ICEing when trying to hash a known NAN.  This is unnoticeable
    because the only user would be IPA, and even so, it currently doesn't
    handle floats.  However, handling floats is a flip of a switch, so
    it's best to handle them already.
    
    gcc/ChangeLog:
    
            * value-range.cc (add_vrange): Handle known NANs.

Diff:
---
 gcc/value-range.cc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 874a1843ebf..2f37ff3e58e 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -269,14 +269,14 @@ add_vrange (const vrange &v, inchash::hash &hstate,
   if (is_a <frange> (v))
     {
       const frange &r = as_a <frange> (v);
-      if (r.varying_p ())
-	hstate.add_int (VR_VARYING);
+      if (r.known_isnan ())
+	hstate.add_int (VR_NAN);
       else
-	hstate.add_int (VR_RANGE);
-
-      hstate.add_real_value (r.lower_bound ());
-      hstate.add_real_value (r.upper_bound ());
-
+	{
+	  hstate.add_int (r.varying_p () ? VR_VARYING : VR_RANGE);
+	  hstate.add_real_value (r.lower_bound ());
+	  hstate.add_real_value (r.upper_bound ());
+	}
       nan_state nan = r.get_nan_state ();
       hstate.add_int (nan.pos_p ());
       hstate.add_int (nan.neg_p ());


More information about the Gcc-cvs mailing list