From 3fd54fb075d6e0639027fbfa0669e240ff73f262 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 17 Dec 2009 20:29:48 +0100 Subject: 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 --- gcc/ipa.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/ipa.c') 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)) -- cgit v1.1