[PATCH] Fix same_comdat_group handling in cgraph_remove_unreachable_nodes (PR c++/42386)
Jakub Jelinek
jakub@redhat.com
Wed Dec 16 21:59:00 GMT 2009
Hi!
We shouldn't consider same_comdat_group links to make nodes reachable for
DECL_EXTERNAL nodes - for those whether they are in the same comdat group or
not doesn't matter.
Bootstrapped/regtested on x86_64-linux. Ok for trunk?
2009-12-16 Jakub Jelinek <jakub@redhat.com>
PR c++/42386
* ipa.c (cgraph_remove_unreachable_nodes): Don't mark
same_comdat_group nodes as reachable if DECL_EXTERNAL.
* g++.dg/opt/dtor3.C: New test.
--- gcc/ipa.c.jj 2009-12-10 22:56:22.000000000 +0100
+++ gcc/ipa.c 2009-12-16 18:26:00.000000000 +0100
@@ -185,6 +185,7 @@ cgraph_remove_unreachable_nodes (bool be
also reachable. */
if (node->same_comdat_group
&& node->reachable
+ && !DECL_EXTERNAL (node->decl)
&& !node->global.inlined_to)
{
for (next = node->same_comdat_group;
--- gcc/testsuite/g++.dg/opt/dtor3.C.jj 2009-12-16 18:08:11.000000000 +0100
+++ gcc/testsuite/g++.dg/opt/dtor3.C 2009-12-16 18:06:36.000000000 +0100
@@ -0,0 +1,11 @@
+// PR c++/42386
+// { dg-do compile }
+// { dg-options "-O2" }
+# 1 "A.h" 1
+#pragma interface
+struct D { virtual bool d () const; };
+struct E { virtual ~E (); virtual void *e () const = 0; };
+struct A : public D, public E { ~A () {} };
+# 5 "F.h" 1
+struct F : public A { void *f () const; void *e () const; };
+void *F::e () const { return __null; }
Jakub
More information about the Gcc-patches
mailing list