]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix floating point bug in fold_range.
authorAndrew MacLeod <amacleod@redhat.com>
Wed, 7 Jun 2023 18:03:35 +0000 (14:03 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Thu, 8 Jun 2023 18:52:04 +0000 (14:52 -0400)
We currently do not have any floating point operators where operand 1 is
a different type than the LHS. When we eventually do there is a bug
in fold_range. If either operand is a known NAN, it returns a NAN
of the type of operand 1 instead of the result type.

* range-op-float.cc (range_operator_float::fold_range): Return
NAN of the result type.

gcc/range-op-float.cc

index a99a6b01ed835ae9755aec03b967d528b45a8c91..af598b60a790df3480d7d6bcc6868dfd82c3c69a 100644 (file)
@@ -57,7 +57,7 @@ range_operator_float::fold_range (frange &r, tree type,
     return true;
   if (op1.known_isnan () || op2.known_isnan ())
     {
-      r.set_nan (op1.type ());
+      r.set_nan (type);
       return true;
     }