aboutsummaryrefslogtreecommitdiff
path: root/gcc/range-op-float.cc
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2023-09-07 15:54:20 -0400
committerAldy Hernandez <aldyh@redhat.com>2023-09-07 18:13:09 -0400
commit7ece864adde82e6906e20a8b841361be2fd649d8 (patch)
treec1d8f533a100845204b71ce2f0da024cafb1397a /gcc/range-op-float.cc
parent7d2274b9e346f44f8f6598b9dbb9fa95259274a2 (diff)
downloadgcc-7ece864adde82e6906e20a8b841361be2fd649d8.zip
gcc-7ece864adde82e6906e20a8b841361be2fd649d8.tar.gz
gcc-7ece864adde82e6906e20a8b841361be2fd649d8.tar.bz2
[irange] Fix typo in contains_zero_p.
In the conversion of iranges to wide_int (commit cb779afeff204f), I mistakenly made contains_zero_p() return TRUE for undefined ranges. This means the rest of the patch was adjusted for this stupidity. For example, we ended up doing the following, to make up for the fact that contains_zero_p was broken: - if (!lhs.contains_p (build_zero_cst (lhs.type ()))) + if (lhs.undefined_p () || !contains_zero_p (lhs)) This patch fixes the thinko and adjusts all callers. In places where a caller is not checking undefined_p(), it is because either the caller has already handled undefined ranges in the preceeding code, or the check is superfluous. gcc/ChangeLog: * value-range.h (contains_zero_p): Return false for undefined ranges. * range-op-float.cc (operator_gt::op1_op2_relation): Adjust for contains_zero_p change above. (operator_ge::op1_op2_relation): Same. (operator_equal::op1_op2_relation): Same. (operator_not_equal::op1_op2_relation): Same. (operator_lt::op1_op2_relation): Same. (operator_le::op1_op2_relation): Same. (operator_ge::op1_op2_relation): Same. * range-op.cc (operator_equal::op1_op2_relation): Same. (operator_not_equal::op1_op2_relation): Same. (operator_lt::op1_op2_relation): Same. (operator_le::op1_op2_relation): Same. (operator_cast::op1_range): Same. (set_nonzero_range_from_mask): Same. (operator_bitwise_xor::op1_range): Same. (operator_addr_expr::fold_range): Same. (operator_addr_expr::op1_range): Same.
Diffstat (limited to 'gcc/range-op-float.cc')
-rw-r--r--gcc/range-op-float.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc
index eebc73f99..89c401e 100644
--- a/gcc/range-op-float.cc
+++ b/gcc/range-op-float.cc
@@ -783,7 +783,7 @@ operator_equal::op1_op2_relation (const irange &lhs, const frange &,
return VREL_NE;
// TRUE = op1 == op2 indicates EQ_EXPR.
- if (lhs.undefined_p () || !contains_zero_p (lhs))
+ if (!contains_zero_p (lhs))
return VREL_EQ;
return VREL_VARYING;
}
@@ -915,7 +915,7 @@ operator_not_equal::op1_op2_relation (const irange &lhs, const frange &,
return VREL_EQ;
// TRUE = op1 != op2 indicates NE_EXPR.
- if (lhs.undefined_p () || !contains_zero_p (lhs))
+ if (!contains_zero_p (lhs))
return VREL_NE;
return VREL_VARYING;
}
@@ -1037,7 +1037,7 @@ operator_lt::op1_op2_relation (const irange &lhs, const frange &,
return VREL_GE;
// TRUE = op1 < op2 indicates LT_EXPR.
- if (lhs.undefined_p () || !contains_zero_p (lhs))
+ if (!contains_zero_p (lhs))
return VREL_LT;
return VREL_VARYING;
}
@@ -1144,7 +1144,7 @@ operator_le::op1_op2_relation (const irange &lhs, const frange &,
return VREL_GT;
// TRUE = op1 <= op2 indicates LE_EXPR.
- if (lhs.undefined_p () || !contains_zero_p (lhs))
+ if (!contains_zero_p (lhs))
return VREL_LE;
return VREL_VARYING;
}