[Bug libitm/53008] abort in _ITM_getTMCloneSafe

2012-05-08 Thread daveboutcher at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53008

--- Comment #3 from Dave Boutcher  2012-05-08 
22:56:23 UTC ---
I just submitted a patch for this one (Issue 6201064)
(http://codereview.appspot.com/6201064/)

Patch included here just for fun:

Index: gcc/trans-mem.c
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 24073fa..20ed5a0 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -4319,6 +4319,9 @@ ipa_tm_create_version_alias (struct cgraph_node *node,
void *data)

   record_tm_clone_pair (old_decl, new_decl);

+  /* If someone refers to this function indirectly, mark it needed */
+  if (ipa_ref_list_first_refering (&info->old_node->ref_list)) 
+  ipa_tm_mark_needed_node (info->old_node);
   if (info->old_node->needed)
 ipa_tm_mark_needed_node (new_node);
   return false;
@@ -4372,6 +4375,10 @@ ipa_tm_create_version (struct cgraph_node *old_node)
   record_tm_clone_pair (old_decl, new_decl);

   cgraph_call_function_insertion_hooks (new_node);
+  /* If someone refers to this function indirectly, mark it needed */
+  if (ipa_ref_list_first_refering (&old_node->ref_list)) 
+  ipa_tm_mark_needed_node (old_node);
+
   if (old_node->needed)
 ipa_tm_mark_needed_node (new_node);

@@ -4778,8 +4785,13 @@ ipa_tm_execute (void)
No need to do this if the function's address can't be taken.  */
 if (is_tm_pure (node->decl))
   {
-if (!node->local.local)
+if (!node->local.local) {
   record_tm_clone_pair (node->decl, node->decl);
+  /* if someone refers to this function other than as a call,
+ mark it needed */
+  if (ipa_ref_list_first_refering (&node->ref_list)) 
+  ipa_tm_mark_needed_node (node);
+}
 continue;
   }


[Bug libitm/53008] abort in _ITM_getTMCloneSafe

2012-05-15 Thread daveboutcher at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53008

--- Comment #6 from Dave Boutcher  2012-05-16 
01:43:51 UTC ---
Thanks for the testcase Patrick.  Let me dig into the pr51516.C failure before
I resubmit the patch with the testcase.

Torvald, as Patrick said, this seems to be purely a gcc issue...no libtm
problems I can see


[Bug libitm/53008] New: abort in _ITM_getTMCloneSafe

2012-04-16 Thread daveboutcher at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53008

 Bug #: 53008
   Summary: abort in _ITM_getTMCloneSafe
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libitm
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: daveboutc...@gmail.com


Created attachment 27169
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27169
testcase for abort in _ITM_getTMCloneSafe

Abort in _ITM_getTMCloneSafe() within atomic transaction calling a function via
a function pointer.  The abort only appears to happen if the function pointer
is defined as __attribute__((transaction_safe)).  Only happens at -O2 and
above.

Fairly minimal testcase attached.


[Bug libitm/53008] abort in _ITM_getTMCloneSafe

2012-04-18 Thread daveboutcher at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53008

--- Comment #1 from Dave Boutcher  2012-04-18 
17:46:17 UTC ---
The problem seems to be that functions referenced only by function pointers are
not put in the tmclone table.  I can work around the problem by making a bogus
call to the function anywhere inside a transaction.