]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix bitwise_or logic for prange.
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 28 Oct 2024 13:47:03 +0000 (09:47 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Mon, 28 Oct 2024 16:46:55 +0000 (12:46 -0400)
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

index 9f500c52d2c66d16185928eaef61e28684a4db9c..ccce05035b9687878cc80083d07c336e73569fb2 100644 (file)
@@ -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);