Fixed.
Bootstrapped on with no regressions. Pushed.
Andrew
On 10/28/24 10:25, Mikael Morin wrote:
Le 28/10/2024 à 14:38, Andrew MacLeod a écrit :
On 10/26/24 15:08, Mikael Morin wrote:
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.
From 1c0ecf06c0c9f3268ba52d4027e9b78aae4acb51 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacl...@redhat.com>
Date: Mon, 28 Oct 2024 09:47:03 -0400
Subject: [PATCH] Fix bitwise_or logic for prange.
Set non-zero only if at least one of the two operands does not contain zero.
* range-op-ptr.cc (operator_bitwise_or::fold_range): Fix logic
for setting nonzero.
---
gcc/range-op-ptr.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/range-op-ptr.cc b/gcc/range-op-ptr.cc
index 9f500c52d2c..ccce05035b9 100644
--- a/gcc/range-op-ptr.cc
+++ b/gcc/range-op-ptr.cc
@@ -388,7 +388,7 @@ operator_bitwise_or::fold_range (prange &r, tree type,
{
// For pointer types, we are really only interested in asserting
// whether the expression evaluates to non-NULL.
- if (!op1.zero_p () || !op2.zero_p ())
+ if (!range_includes_zero_p (op1) || !range_includes_zero_p (op2))
r.set_nonzero (type);
else if (op1.zero_p () && op2.zero_p ())
r.set_zero (type);
--
2.45.0