aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/g++.dg/pr101511.C22
-rw-r--r--gcc/value-relation.cc8
2 files changed, 28 insertions, 2 deletions
diff --git a/gcc/testsuite/g++.dg/pr101511.C b/gcc/testsuite/g++.dg/pr101511.C
new file mode 100644
index 0000000..ee2c7fd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr101511.C
@@ -0,0 +1,22 @@
+// { dg-do compile }
+// { dg-options "-O2 -Wno-div-by-zero" }
+
+void __assert_fail(const char *, const char *, int, const char *)
+ __attribute__((__noreturn__));
+template <typename T> void test_uint() {
+ long __trans_tmp_3, __trans_tmp_1;
+ int Error;
+ for (;;) {
+ {
+ unsigned long Tmp = -1;
+ __trans_tmp_3 = Tmp - Tmp % 0;
+ }
+ Error += 0 == __trans_tmp_3 ? 0 : 1;
+ !Error ? void() : __assert_fail("", "", 3, __PRETTY_FUNCTION__);
+ T Tmp = -1;
+ __trans_tmp_1 = Tmp - Tmp % 0;
+ Error += 0 == __trans_tmp_1 ? 0 : 1;
+ !Error ? void() : __assert_fail("", "", 7, __PRETTY_FUNCTION__);
+ }
+}
+void test() { test_uint<unsigned long>(); }
diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc
index 43fcab7..bcfe388 100644
--- a/gcc/value-relation.cc
+++ b/gcc/value-relation.cc
@@ -873,11 +873,15 @@ relation_oracle::query_relation (basic_block bb, tree ssa1, tree ssa2)
if (kind != VREL_NONE)
return kind;
- // If one is not found, see if there is a relationship between equivalences.
// If v2 isn't in v1s equiv set, then v1 shouldn't be in v2's set either.
+ // It is possible for out-of-order dominator processing to have an out of
+ // sync set of equivalences.. Down the road, when we do full updates,
+ // change this to an assert to ensure everything is in sync.
const_bitmap equiv2 = equiv_set (ssa2, bb);
- gcc_checking_assert (!equiv2 || !bitmap_bit_p (equiv2, v1));
+ if (equiv2 && bitmap_bit_p (equiv2, v1))
+ return EQ_EXPR;
+ // If not equal, see if there is a relationship between equivalences.
if (!equiv1 && !equiv2)
kind = VREL_NONE;
else if (!equiv1)