summaryrefslogtreecommitdiff
path: root/gcc/ipa.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-07-08 23:33:44 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-07-08 23:33:44 -0400
commit2fda8e144a7db5ba6025cfe643da0c6111cc2b0f (patch)
tree91cf7e9a3eeaae34dd4f07d9086f498096305f0d /gcc/ipa.c
parente8f8774a901e9645bfadc23d4e72be552b0e9b72 (diff)
downloadgcc-2fda8e144a7db5ba6025cfe643da0c6111cc2b0f.tar.gz
cgraph.c (cgraph_add_to_same_comdat_group): New.
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. From-SVN: r176071
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r--gcc/ipa.c29
1 files changed, 6 insertions, 23 deletions
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;