public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [trans-mem, committed] Fix 60908
Date: Tue, 26 Jan 2016 17:34:00 -0000	[thread overview]
Message-ID: <56A7AE2C.7000300@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 110 bytes --]

Just a silly think-o in building the tm region tree,
which resulted in the one region being found twice.


r~

[-- Attachment #2: z --]
[-- Type: text/plain, Size: 1352 bytes --]

        PR middle-end/60908
        * trans-mem.c (tm_region_init): Mark entry block as visited.

testsuite/
        * gcc.dg/tm/pr60908.c: New test.



diff --git a/gcc/testsuite/gcc.dg/tm/pr60908.c b/gcc/testsuite/gcc.dg/tm/pr60908.c
new file mode 100644
index 0000000..773438d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr60908.c
@@ -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;
+    }
+}
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index b204760..500071f 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -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 ();

                 reply	other threads:[~2016-01-26 17:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=56A7AE2C.7000300@redhat.com \
    --to=rth@redhat.com \
    --cc=gcc-patches@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).