aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2023-06-07 14:03:35 -0400
committerAndrew MacLeod <amacleod@redhat.com>2023-06-08 14:52:04 -0400
commitce81740c44c07a82a0839fa8c08a0a51a72c5cfe (patch)
tree166eedd213042e9ac1287e22bc3d5fe2769a3558
parent1379ae33e05c28d705f3c69a3f6c774bf6e83136 (diff)
downloadgcc-ce81740c44c07a82a0839fa8c08a0a51a72c5cfe.zip
gcc-ce81740c44c07a82a0839fa8c08a0a51a72c5cfe.tar.gz
gcc-ce81740c44c07a82a0839fa8c08a0a51a72c5cfe.tar.bz2
Fix floating point bug in fold_range.
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.
-rw-r--r--gcc/range-op-float.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index a99a6b0..af598b6 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -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;
}