aboutsummaryrefslogtreecommitdiff
path: root/gcc/value-range.h
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/value-range.h
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/value-range.h')
-rw-r--r--gcc/value-range.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/value-range.h b/gcc/value-range.h
index 6c5be36..da04be0 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -1158,7 +1158,7 @@ inline bool
contains_zero_p (const irange &r)
{
if (r.undefined_p ())
- return true;
+ return false;
wide_int zero = wi::zero (TYPE_PRECISION (r.type ()));
return r.contains_p (zero);