public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "patrick.marlier at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/53008] abort in _ITM_getTMCloneSafe
Date: Tue, 22 May 2012 16:11:00 -0000	[thread overview]
Message-ID: <bug-53008-4-Lc0s0hF4cS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53008-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2012-05-22 15:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 15:08 [Bug libitm/53008] New: " daveboutcher at gmail dot com
2012-04-18 17:47 ` [Bug libitm/53008] " daveboutcher at gmail dot com
2012-04-27 15:00 ` patrick.marlier at gmail dot com
2012-05-08 23:24 ` daveboutcher at gmail dot com
2012-05-15 16:50 ` torvald at gcc dot gnu.org
2012-05-15 22:32 ` patrick.marlier at gmail dot com
2012-05-16  2:12 ` daveboutcher at gmail dot com
2012-05-22 15:59 ` [Bug ada/53008] " aldyh at gcc dot gnu.org
2012-05-22 16:11 ` patrick.marlier at gmail dot com [this message]
2012-05-22 17:38 ` [Bug middle-end/53008] " aldyh at gcc dot gnu.org
2012-05-25 17:29 ` aldyh at gcc dot gnu.org
2012-05-30 22:15 ` aldyh at gcc dot gnu.org
2012-05-30 22:25 ` aldyh at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53008-4-Lc0s0hF4cS@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).