diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2020-04-27 14:18:35 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2020-04-28 18:26:31 +0200 |
commit | 4a7bfd79b39b751f7fd864c4e65c478dea9d3dd2 (patch) | |
tree | 59d1e155e10dd9e3aa017a75c2552be7d221ef30 | |
parent | 73d5e1ca792f8844dac4a5e834a41b1cebccecac (diff) | |
download | gcc-4a7bfd79b39b751f7fd864c4e65c478dea9d3dd2.zip gcc-4a7bfd79b39b751f7fd864c4e65c478dea9d3dd2.tar.gz gcc-4a7bfd79b39b751f7fd864c4e65c478dea9d3dd2.tar.bz2 |
Fix union_ so it works with signed 1-bit numbers.
-rw-r--r-- | gcc/range-op.cc | 12 | ||||
-rw-r--r-- | gcc/value-range.cc | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 9d8bc6e..85fb187 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -3375,6 +3375,18 @@ range_tests () int_range<1> i1, i2, i3; int_range<1> r0, r1, rold; + // Test 1-bit signed integer union. + // [-1,-1] U [0,0] = VARYING. + tree one_bit_type = build_nonstandard_integer_type (1, 0); + { + tree one_bit_min = vrp_val_min (one_bit_type); + tree one_bit_max = vrp_val_max (one_bit_type); + int_range<2> min (one_bit_min, one_bit_min); + int_range<2> max (one_bit_max, one_bit_max); + max.union_ (min); + ASSERT_TRUE (max.varying_p ()); + } + // Test that NOT(255) is [0..254] in 8-bit land. int_range<1> not_255 (UCHAR (255), UCHAR (255), VR_ANTI_RANGE); ASSERT_TRUE (not_255 == int_range<1> (UCHAR (0), UCHAR (254))); diff --git a/gcc/value-range.cc b/gcc/value-range.cc index cc260f1..379792d 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -1878,7 +1878,7 @@ irange::multi_range_union (const irange &r) // Overflow indicates we are at MAX already. // A wide int bug requires the previous max_val check // trigger: gcc.c-torture/compile/pr80443.c with -O3 - if (ovf) + if (ovf == wi::OVF_OVERFLOW) break; // Current upper+1 is >= lower bound next pair, then we merge ranges. |