Hello, Le 24/10/2024 à 14:53, Andrew MacLeod a écrit :
diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc index dd312a80366..ef2b2cce516 100644 --- a/gcc/range-op-ptr.cc +++ b/gcc/range-op-ptr.cc
(...)
-void -pointer_or_operator::wi_fold (irange &r, tree type, - const wide_int &lh_lb, - const wide_int &lh_ub, - const wide_int &rh_lb, - const wide_int &rh_ub) const +operator_bitwise_or::fold_range (prange &r, tree type, + const prange &op1, + const prange &op2, + relation_trio) const { // For pointer types, we are really only interested in asserting // whether the expression evaluates to non-NULL. - if (!wi_includes_zero_p (type, lh_lb, lh_ub) - && !wi_includes_zero_p (type, rh_lb, rh_ub)) + if (!op1.zero_p () || !op2.zero_p ()) r.set_nonzero (type);
this doesn't feel right. It checks that the operand range is anything but singleton [0], instead of checking that it does not contain 0.
- else if (wi_zero_p (type, lh_lb, lh_ub) && wi_zero_p (type, rh_lb, rh_ub)) + else if (op1.zero_p () && op2.zero_p ()) r.set_zero (type); else r.set_varying (type);
And it makes this else branch dead.
+ + update_known_bitmask (r, BIT_IOR_EXPR, op1, op2); + return true; }
For example, the change makes VARYING | 0 fold to non-zero (instead of VARYING).