]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Hash known NANs correctly for franges.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 24 May 2023 17:53:53 +0000 (19:53 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Thu, 25 May 2023 05:24:52 +0000 (07:24 +0200)
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.

gcc/value-range.cc

index 874a1843ebf6d17ed70a17f21b1bd9d32cf4e437..2f37ff3e58e0947741ec50fd053977468f034a2c 100644 (file)
@@ -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 ());