re PR middle-end/56108 (Asm statement in transaction_relaxed crashes compiler.)
authorAldy Hernandez <aldyh@redhat.com>
Thu, 21 Feb 2013 20:16:26 +0000 (20:16 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Thu, 21 Feb 2013 20:16:26 +0000 (20:16 +0000)
PR middle-end/56108
* trans-mem.c (execute_tm_mark): Do not expand transactions that
are sure to go irrevocable.
testsuite/
* gcc.dg/tm/memopt-1.c: Declare functions transaction_safe.

From-SVN: r196213

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

index 1528663..343417c 100644 (file)
@@ -1,3 +1,9 @@
+2013-02-20  Aldy Hernandez  <aldyh@redhat.com>
+
+       PR middle-end/56108
+       * trans-mem.c (execute_tm_mark): Do not expand transactions that
+       are sure to go irrevocable.
+
 2013-02-21  Hans-Peter Nilsson  <hp@axis.com>
 
        * doc/rtl.texi (vec_concat, vec_duplicate): Mention that
index 8f0ec27..5bffe43 100644 (file)
@@ -1,3 +1,8 @@
+2013-02-20  Aldy Hernandez  <aldyh@redhat.com>
+
+       PR middle-end/56108
+       * gcc.dg/tm/memopt-1.c: Declare functions transaction_safe.
+
 2013-02-21  Martin Jambor  <mjambor@suse.cz>
 
        PR tree-optimization/56310
index b78a6d4..c5ac5ce 100644 (file)
@@ -2,8 +2,8 @@
 /* { dg-options "-fgnu-tm -O -fdump-tree-tmmemopt" } */
 
 long g, xxx, yyy;
-extern george() __attribute__((transaction_callable));
-extern ringo(long int);
+extern george() __attribute__((transaction_safe));
+extern ringo(long int) __attribute__((transaction_safe));
 int i;
 
 f()
diff --git a/gcc/testsuite/gcc.dg/tm/pr56108.c b/gcc/testsuite/gcc.dg/tm/pr56108.c
new file mode 100644 (file)
index 0000000..81ff574
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O" } */
+
+int
+main()
+{
+  __transaction_relaxed { __asm__(""); }
+  return 0;
+}
index dd3918e..71eaa44 100644 (file)
@@ -2859,8 +2859,23 @@ execute_tm_mark (void)
   // Expand memory operations into calls into the runtime.
   // This collects log entries as well.
   FOR_EACH_VEC_ELT (bb_regions, i, r)
-    if (r != NULL)
-      expand_block_tm (r, BASIC_BLOCK (i));
+    {
+      if (r != NULL)
+       {
+         if (r->transaction_stmt)
+           {
+             unsigned sub = gimple_transaction_subcode (r->transaction_stmt);
+
+             /* If we're sure to go irrevocable, there won't be
+                anything to expand, since the run-time will go
+                irrevocable right away.  */
+             if (sub & GTMA_DOES_GO_IRREVOCABLE
+                 && sub & GTMA_MAY_ENTER_IRREVOCABLE)
+               continue;
+           }
+         expand_block_tm (r, BASIC_BLOCK (i));
+       }
+    }
 
   bb_regions.release ();