aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-12-17 20:29:48 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-12-17 20:29:48 +0100
commit3fd54fb075d6e0639027fbfa0669e240ff73f262 (patch)
treea04291e9f2a139e5a1341ab2888846bb997dd2d3 /gcc
parenta0274eae644ea499d83f4090a915bc8bf2f77c77 (diff)
downloadgcc-3fd54fb075d6e0639027fbfa0669e240ff73f262.zip
gcc-3fd54fb075d6e0639027fbfa0669e240ff73f262.tar.gz
gcc-3fd54fb075d6e0639027fbfa0669e240ff73f262.tar.bz2
re PR tree-optimization/42386 (ICE in ipcp_iterate_stage, at ipa-cp.c:766)
PR c++/42386 * ipa.c (function_and_variable_visibility): Clear same_comdat_group links of DECL_EXTERNAL nodes. * g++.dg/opt/dtor3.C: New test. From-SVN: r155321
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa.c17
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/opt/dtor3.C11
4 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b7338c5..90dc2c8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-12-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/42386
+ * ipa.c (function_and_variable_visibility): Clear same_comdat_group
+ links of DECL_EXTERNAL nodes.
+
2009-12-17 Sandra Loosemore <sandra@codesourcery.com>
* doc/rtl.texi (Vector Operations): Clarify vec_select result mode.
diff --git a/gcc/ipa.c b/gcc/ipa.c
index b1844db..1230448 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -370,6 +370,23 @@ function_and_variable_visibility (bool whole_program)
happy. Clear the flag here to avoid confusion in middle-end. */
if (DECL_COMDAT (node->decl) && !TREE_PUBLIC (node->decl))
DECL_COMDAT (node->decl) = 0;
+ /* For external decls stop tracking same_comdat_group, it doesn't matter
+ what comdat group they are in when they won't be emitted in this TU,
+ and simplifies later passes. */
+ if (node->same_comdat_group && DECL_EXTERNAL (node->decl))
+ {
+ struct cgraph_node *n = node, *next;
+ do
+ {
+ /* If at least one of same comdat group functions is external,
+ all of them have to be, otherwise it is a front-end bug. */
+ gcc_assert (DECL_EXTERNAL (n->decl));
+ next = n->same_comdat_group;
+ n->same_comdat_group = NULL;
+ n = next;
+ }
+ while (n != node);
+ }
gcc_assert ((!DECL_WEAK (node->decl) && !DECL_COMDAT (node->decl))
|| TREE_PUBLIC (node->decl) || DECL_EXTERNAL (node->decl));
if (cgraph_externally_visible_p (node, whole_program))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f6ee735..a8ee952 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/42386
+ * g++.dg/opt/dtor3.C: New test.
+
2009-12-17 Arnaud Charlet <charlet@adacore.com>
* ada/acats/run_all.sh: Strip comments from norun.lst
diff --git a/gcc/testsuite/g++.dg/opt/dtor3.C b/gcc/testsuite/g++.dg/opt/dtor3.C
new file mode 100644
index 0000000..2d93098
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/dtor3.C
@@ -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 "dtor3.C" 1
+struct F : public A { void *f () const; void *e () const; };
+void *F::e () const { return __null; }