re PR c++/58678 (pykde4-4.11.2 link error (devirtualization too trigger happy))
authorJason Merrill <jason@redhat.com>
Thu, 11 Sep 2014 12:12:28 +0000 (08:12 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 11 Sep 2014 12:12:28 +0000 (08:12 -0400)
PR c++/58678
* ipa-devirt.c (ipa_devirt): Don't check DECL_COMDAT.

From-SVN: r215168

gcc/ChangeLog
gcc/ipa-devirt.c
gcc/testsuite/g++.dg/ipa/devirt-28a.C [new file with mode: 0644]

index 014014a8c148663f21b9b16476a40dd301fd355c..f3bfbe00577159b13df3f19f822f101cd4961125 100644 (file)
@@ -1,3 +1,8 @@
+2014-09-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/58678
+       * ipa-devirt.c (ipa_devirt): Don't check DECL_COMDAT.
+
 2014-09-11  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/63223
index f98a18e7b8f14161a91407bf1ea2278639e36223..948ae2375048253be0206cbbd852338e69360bea 100644 (file)
@@ -3952,8 +3952,7 @@ ipa_devirt (void)
            /* Don't use an implicitly-declared destructor (c++/58678).  */
            struct cgraph_node *non_thunk_target
              = likely_target->function_symbol ();
-           if (DECL_ARTIFICIAL (non_thunk_target->decl)
-               && DECL_COMDAT (non_thunk_target->decl))
+           if (DECL_ARTIFICIAL (non_thunk_target->decl))
              {
                if (dump_file)
                  fprintf (dump_file, "Target is artificial\n\n");
diff --git a/gcc/testsuite/g++.dg/ipa/devirt-28a.C b/gcc/testsuite/g++.dg/ipa/devirt-28a.C
new file mode 100644 (file)
index 0000000..bdd1682
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/58678
+// { dg-options "-O3 -flto -shared -fPIC -Wl,--no-undefined" }
+// { dg-do link { target { gld && fpic } } }
+
+struct A {
+  virtual ~A();
+};
+struct B : A {
+  virtual int m_fn1();
+};
+void fn1(B* b) {
+  delete b;
+}
+
+int main() {}