PR middle-end/60908
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Jan 2016 17:29:02 +0000 (17:29 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Jan 2016 17:29:02 +0000 (17:29 +0000)
  * trans-mem.c (tm_region_init): Mark entry block as visited.
testsuite/
  * gcc.dg/tm/pr60908.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232839 138bc75d-0d04-0410-961f-82ee72b054a4

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

index f030101..fef8cfe 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-26  Richard Henderson  <rth@redhat.com>
+
+       PR middle-end/60908
+       * trans-mem.c (tm_region_init): Mark entry block as visited.
+
 2016-01-26  David Malcolm  <dmalcolm@redhat.com>
 
        PR other/69006
index 18aa8af..3e40014 100644 (file)
@@ -1,3 +1,7 @@
+2016-01-26  Richard Henderson  <rth@redhat.com>
+
+       * gcc.dg/tm/pr60908.c: New test.
+
 2016-01-26  David Malcolm  <dmalcolm@redhat.com>
 
        PR other/69006
diff --git a/gcc/testsuite/gcc.dg/tm/pr60908.c b/gcc/testsuite/gcc.dg/tm/pr60908.c
new file mode 100644 (file)
index 0000000..773438d
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+int t, v;
+
+int
+foo (void)
+{
+  while (1)
+    {
+      __transaction_atomic { v++; }
+      if (t)
+        return 0;
+    }
+}
index b204760..500071f 100644 (file)
@@ -2039,16 +2039,17 @@ tm_region_init (struct tm_region *region)
   struct tm_region *old_region;
   auto_vec<tm_region *> bb_regions;
 
-  all_tm_regions = region;
-  bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
-
   /* We could store this information in bb->aux, but we may get called
      through get_all_tm_blocks() from another pass that may be already
      using bb->aux.  */
   bb_regions.safe_grow_cleared (last_basic_block_for_fn (cfun));
 
+  all_tm_regions = region;
+  bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
   queue.safe_push (bb);
+  bitmap_set_bit (visited_blocks, bb->index);
   bb_regions[bb->index] = region;
+
   do
     {
       bb = queue.pop ();