From dabebf7ecc90b59b0603d2428cf465fe1f0d642b Mon Sep 17 00:00:00 2001 From: jason Date: Sat, 9 Jul 2011 03:33:44 +0000 Subject: gcc/ * cgraph.c (cgraph_add_to_same_comdat_group): New. * cgraph.h: Declare it. * ipa.c (function_and_variable_visibility): Make sure thunks have the right visibility. gcc/cp/ * method.c (use_thunk): Use cgraph_add_to_same_comdat_group. * optimize.c (maybe_clone_body): Likewise. * semantics.c (maybe_add_lambda_conv_op): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176071 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ipa.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) (limited to 'gcc/ipa.c') diff --git a/gcc/ipa.c b/gcc/ipa.c index 5b09250d661..9d54811e5c9 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -865,31 +865,14 @@ function_and_variable_visibility (bool whole_program) decl_node = cgraph_function_node (decl_node->callees->callee, NULL); /* Thunks have the same visibility as function they are attached to. - For some reason C++ frontend don't seem to care. I.e. in - g++.dg/torture/pr41257-2.C the thunk is not comdat while function - it is attached to is. - - We also need to arrange the thunk into the same comdat group as - the function it reffers to. */ + Make sure the C++ front end set this up properly. */ if (DECL_ONE_ONLY (decl_node->decl)) { - DECL_COMDAT (node->decl) = DECL_COMDAT (decl_node->decl); - DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP (decl_node->decl); - if (DECL_ONE_ONLY (decl_node->decl) && !node->same_comdat_group) - { - node->same_comdat_group = decl_node; - if (!decl_node->same_comdat_group) - decl_node->same_comdat_group = node; - else - { - struct cgraph_node *n; - for (n = decl_node->same_comdat_group; - n->same_comdat_group != decl_node; - n = n->same_comdat_group) - ; - n->same_comdat_group = node; - } - } + gcc_checking_assert (DECL_COMDAT (node->decl) + == DECL_COMDAT (decl_node->decl)); + gcc_checking_assert (DECL_COMDAT_GROUP (node->decl) + == DECL_COMDAT_GROUP (decl_node->decl)); + gcc_checking_assert (node->same_comdat_group); } if (DECL_EXTERNAL (decl_node->decl)) DECL_EXTERNAL (node->decl) = 1; -- cgit v1.2.1