aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-04-27 17:07:26 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-04-28 18:26:31 +0200
commit4e3a54f0eaa48f69a6bc4889653db9e07312d13b (patch)
tree33f5e29d979dc34ec8d3b47971f7190fbbb13448
parent6273e85ad801e9e0bfe60451708940cd90baa67a (diff)
downloadgcc-4e3a54f0eaa48f69a6bc4889653db9e07312d13b.zip
gcc-4e3a54f0eaa48f69a6bc4889653db9e07312d13b.tar.gz
gcc-4e3a54f0eaa48f69a6bc4889653db9e07312d13b.tar.bz2
Use varying if we can't determine anything on a bitwise AND op1_range.
-rw-r--r--gcc/range-op.cc10
1 files changed, 7 insertions, 3 deletions
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;