http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53008
--- Comment #8 from Patrick Marlier <patrick.marlier at gmail dot com> 2012-05-22 15:58:53 UTC --- Aldy, Actually the problem is different that my first thought and it is a real bug. The problem is well described into the 'testcase for gcc testsuite'. In the testcase, you have a static function foo which is transaction_safe so a clone is created. This function foo is assigned to a transaction_safe function pointer and this function pointer is used in a transaction. However this tm-clone foo is never referenced so it is removed by ipa.c:cgraph_remove_unreachable_nodes(). One way to fix the problem is force the output of the clone as following: Index: trans-mem.c =================================================================== --- trans-mem.c (revision 187371) +++ trans-mem.c (working copy) @@ -4330,7 +4330,8 @@ ipa_tm_create_version_alias (struct cgraph_node *n record_tm_clone_pair (old_decl, new_decl); - if (info->old_node->symbol.force_output) + if (info->old_node->symbol.force_output + || ipa_ref_list_first_referring (&info->old_node->symbol.ref_list)) ipa_tm_mark_force_output_node (new_node); return false; } @@ -4383,7 +4384,8 @@ ipa_tm_create_version (struct cgraph_node *old_nod record_tm_clone_pair (old_decl, new_decl); cgraph_call_function_insertion_hooks (new_node); - if (old_node->symbol.force_output) + if (old_node->symbol.force_output + || ipa_ref_list_first_referring (&old_node->symbol.ref_list)) ipa_tm_mark_force_output_node (new_node); /* Do the same thing, but for any aliases of the original node. */ However, I am not sure it is really the way to go. Probably we should add the references from the orginal function to the tm-clone? Thanks, Patrick