public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/49581] [trans-mem] save/restore of thread-local data in nested txns is missing
Date: Wed, 11 Jan 2012 17:24:00 -0000	[thread overview]
Message-ID: <bug-49581-4-pp26UiyM12@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49581-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49581

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-01-11 17:23:54 UTC ---
On closer inspection, no I can't reproduce this.

The outer transaction has correct PHI nodes with values dependent on whether
the transaction got aborted/restarted or whether we fell through from the
innermost transaction:

  # x$6_15 = PHI <10(3), 22(6)>
  # x$5_14 = PHI <10(3), 123(6)>
<L2>:
  y.0_7 = x$5_14 + x$6_15;
  D.1814_21 = (unsigned int) y.0_7;
  __builtin__ITM_WU4 (&y, D.1814_21);
  __builtin__ITM_commitTransaction ();

I have verified this by visual inspection of the tree dumps and by modifying
the test to print x[5] and x[6] at the end of main().  Upon execution, x[5] and
x[6] look correct when the transaction cancels (10 and 10) and when the
transaction succeeds (123, 22).

This is what I have in main:

      x[6] += 12;
      if (foo(2)) __transaction_cancel;
    }
    y = x[5] + x[6];
  }
  printf("x[5]=%d, x[6]=%d\n", x[5], x[6]); <-- IS CORRECT

I also added a separately linkable foo() to trigger success or failure:

 int y;
__attribute__((transaction_safe))
 int foo(int x)
{
  return 1; /* fail transaction */
}

Torvald do you mind looking at this again?  At least on a transaction cancel
everything is working fine.

If you can't reproduce, can you close the PR?


  parent reply	other threads:[~2012-01-11 17:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 15:52 [Bug c/49581] New: " torvald at gcc dot gnu.org
2012-01-11 15:36 ` [Bug c/49581] " aldyh at gcc dot gnu.org
2012-01-11 17:24 ` aldyh at gcc dot gnu.org [this message]
2012-01-31 13:27 ` torvald 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-49581-4-pp26UiyM12@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).