re PR rtl-optimization/91164 (ICE in verify_dominators, at dominance.c:1184 (error...
authorJakub Jelinek <jakub@redhat.com>
Tue, 16 Jul 2019 11:37:05 +0000 (13:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 16 Jul 2019 11:37:05 +0000 (13:37 +0200)
PR rtl-optimization/91164
* dse.c (rest_of_handle_dse): If dead edges have been purged,
invalidate dominance info.

* g++.dg/opt/pr91164.C: New test.

From-SVN: r273522

gcc/ChangeLog
gcc/dse.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr91164.C [new file with mode: 0644]

index 30e6e7e..1eb2797 100644 (file)
@@ -1,3 +1,9 @@
+2019-07-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/91164
+       * dse.c (rest_of_handle_dse): If dead edges have been purged,
+       invalidate dominance info.
+
 2019-07-16  Richard Sandiford  <richard.sandiford@arm.com>
 
        * read-md.h (md_reader::record_potential_iterator_use): Add a
index a1c7e3b..8d7358d 100644 (file)
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -3621,7 +3621,10 @@ rest_of_handle_dse (void)
   if ((locally_deleted || globally_deleted)
       && cfun->can_throw_non_call_exceptions
       && purge_all_dead_edges ())
-    cleanup_cfg (0);
+    {
+      free_dominance_info (CDI_DOMINATORS);
+      cleanup_cfg (0);
+    }
 
   return 0;
 }
index 633ded6..1f04ebb 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/91164
+       * g++.dg/opt/pr91164.C: New test.
+
 2019-07-16  Jan Hubicka  <jh@suse.cz>
 
        * g++.dg/lto/alias-1_0.C: Use -O3.
diff --git a/gcc/testsuite/g++.dg/opt/pr91164.C b/gcc/testsuite/g++.dg/opt/pr91164.C
new file mode 100644 (file)
index 0000000..8cf4fd0
--- /dev/null
@@ -0,0 +1,89 @@
+// PR rtl-optimization/91164
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fdelete-dead-exceptions -fnon-call-exceptions -fno-rerun-cse-after-loop -fno-tree-forwprop" }
+
+template <typename, typename = int> class b;
+template <int v> struct d { static constexpr int e = v; };
+template <bool, typename f> using g = f;
+struct h { template <typename i> using j = i; };
+template <typename, typename f> using k = h::j<f>;
+void *operator new(__SIZE_TYPE__, void *);
+struct l { l(); };
+struct m;
+template <typename n> n aa(m);
+struct o { template <typename> using ab = l; };
+template <typename, typename> struct b {
+  struct q : o::ab<int> { q(int, l = l()) : p() {} int p; } ac;
+  void ad();
+  b() : ac(0) {}
+  ~b() { bool r = ac.p == 0; if (r) ad(); }
+  const wchar_t *ae();
+};
+struct m {};
+struct t { virtual void f(); };
+struct u { l a; };
+struct af : t {
+  struct ag { ag(l); };
+  af(l ah) : ai(ah) {}
+  ag ai;
+};
+struct w {
+  template <typename f, typename x> w(f, x y) { new (0) af(y.a); }
+};
+struct z {
+  using aj = int;
+  template <typename x> z(x ah) : ak(al, ah) {}
+  aj al;
+  w ak;
+};
+struct am : z { template <typename x> am(x ah) : z(ah) {} };
+template <typename, typename x> am an(x) { return u{}; }
+template <typename> am ao() { return an<int>(l()); }
+struct ap {
+  k<int, int> aq;
+  k<int, int> ar;
+  k<int, int> as;
+};
+struct at { ap a; long au; ap av; ap aw; };
+struct ax { at c; ax() : c() {} };
+enum ay : int;
+ay az, ba;
+struct bb { bb(wchar_t *, wchar_t *, ay, m); };
+template <typename bc> struct bd {
+  typedef typename bc::be *bf;
+  bd(bf, bf, const typename bc::bg &, ay);
+  ay bh;
+  bb bi;
+  am bj;
+  typename bc::bk e;
+  ax bl;
+  int bm;
+};
+template <typename, typename> using bn = g<d<false>::e, am>;
+template <typename bc>
+bd<bc>::bd(bf ah, bf y, const typename bc::bg &bu, ay)
+    : bi(ah, y, bh, bu), bj(ao<bc>()), bm(aa<int>(bu)) {}
+struct bt { typedef wchar_t be; typedef b<be> bk; typedef m bg; };
+template <typename bc, typename bo> bn<bo, bc> bar();
+template <typename bc, typename bo> bn<bo, bc> bq(bo) {
+  typename bc::bg bp;
+  auto bs = nullptr;
+  using br = bd<bc>;
+  br(bs, bs, bp, ba);
+  return bar<bc, bo>();
+}
+struct bw {
+  bw();
+  template <typename bv, typename x> void assign(b<bv, x> ah) {
+    const wchar_t by = *ah.ae();
+    bw(&by, ah.ae(), bp, az);
+  }
+  template <typename bo> bw(bo, bo y, m, ay) : automaton(bq<bt>(y)) {}
+  m bp;
+  am automaton;
+};
+void bx() {
+  b<wchar_t> s;
+  bw ca;
+  ca.assign(s);
+}