re PR middle-end/53008 (abort in _ITM_getTMCloneSafe)
authorAldy Hernandez <aldyh@redhat.com>
Fri, 25 May 2012 17:14:25 +0000 (17:14 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Fri, 25 May 2012 17:14:25 +0000 (17:14 +0000)
        PR middle-end/53008
        * trans-mem.c (ipa_tm_create_version_alias): Output new_node if
        accessed indirectly.
        (ipa_tm_create_version): Same.

From-SVN: r187887

gcc/ChangeLog
gcc/testsuite/gcc.dg/tm/pr53008.c [new file with mode: 0644]
gcc/trans-mem.c

index ce680f0c817cb1e0321324d9f3d3274253fc2319..f8570fd24d5f56ba278fef3cd305e51d496d1ccb 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-25  Aldy Hernandez  <aldyh@redhat.com>
+
+       PR middle-end/53008
+       * trans-mem.c (ipa_tm_create_version_alias): Output new_node if
+       accessed indirectly.
+       (ipa_tm_create_version): Same.
+
 2012-05-25  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/53474
diff --git a/gcc/testsuite/gcc.dg/tm/pr53008.c b/gcc/testsuite/gcc.dg/tm/pr53008.c
new file mode 100644 (file)
index 0000000..1374d76
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+void __attribute__((transaction_safe)) (*fn)(void);
+
+static void __attribute__((transaction_safe))
+foo(void)
+{
+}
+
+void set_fn(void)
+{
+  fn = foo;
+}
index 8887b9afee6688b20cb6f7469d2d77602a7fe8ca..aa4d7c0a06d1944d4d161b3fbbba38f39004afff 100644 (file)
@@ -4328,7 +4328,8 @@ ipa_tm_create_version_alias (struct cgraph_node *node, void *data)
 
   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;
 }
@@ -4381,7 +4382,8 @@ 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 (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.  */