From 4e3a54f0eaa48f69a6bc4889653db9e07312d13b Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Mon, 27 Apr 2020 17:07:26 +0200 Subject: Use varying if we can't determine anything on a bitwise AND op1_range. --- gcc/range-op.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/range-op.cc b/gcc/range-op.cc index ec60af0..b64f043 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -2207,14 +2207,16 @@ operator_bitwise_and::simple_op1_range_solver (irange &r, tree type, minv = masked_increment (valv, cst2v, sgnbit, nprec); if (minv == valv) { - r.set_varying (type); - we_know_nothing = true; // If we can't determine anything on this bound, fall // through and conservatively solve for the other end point. + we_know_nothing = true; } } maxv = wi::mask (nprec - (cst2n ? 1 : 0), false, nprec); - r = int_range<1> (type, minv, maxv); + if (we_know_nothing) + r.set_varying (type); + else + r = int_range<1> (type, minv, maxv); // Solve [-INF, lhs.upper_bound ()] = x & MASK. // @@ -2235,6 +2237,8 @@ operator_bitwise_and::simple_op1_range_solver (irange &r, tree type, maxv = masked_increment (valv, cst2v, sgnbit, nprec); if (maxv == valv) { + // If we couldn't determine anything on either bound, return + // undefined. if (we_know_nothing) r.set_undefined (); return; -- cgit v1.1