public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49581] New: [trans-mem] save/restore of thread-local data in nested txns is missing
@ 2011-06-29 15:52 torvald at gcc dot gnu.org
  2012-01-11 15:36 ` [Bug c/49581] " aldyh at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: torvald at gcc dot gnu.org @ 2011-06-29 15:52 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [trans-mem] save/restore of thread-local data in
                    nested txns is missing
           Product: gcc
           Version: trans-mem
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: torvald@gcc.gnu.org


Created attachment 24632
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24632
test case

In the attached test case, stores to x[5] and x[6] in the nested txn do not get
rolled back. This happens if the nested txn is restarted by the TM runtime
library, or if the nested txn is aborted via __transaction_cancel.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/49581] [trans-mem] save/restore of thread-local data in nested txns is missing
  2011-06-29 15:52 [Bug c/49581] New: [trans-mem] save/restore of thread-local data in nested txns is missing torvald at gcc dot gnu.org
@ 2012-01-11 15:36 ` aldyh at gcc dot gnu.org
  2012-01-11 17:24 ` aldyh at gcc dot gnu.org
  2012-01-31 13:27 ` torvald at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-01-11 15:36 UTC (permalink / raw)
  To: gcc-bugs

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-11
                 CC|                            |aldyh at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-01-11 15:36:29 UTC ---
The testcase should have s/__transaction/__transaction_atomic/ because of the
front-end changes.

Confirmed for -On where n > 0.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/49581] [trans-mem] save/restore of thread-local data in nested txns is missing
  2011-06-29 15:52 [Bug c/49581] New: [trans-mem] save/restore of thread-local data in nested txns is missing 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
  2012-01-31 13:27 ` torvald at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-01-11 17:24 UTC (permalink / raw)
  To: gcc-bugs

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?


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/49581] [trans-mem] save/restore of thread-local data in nested txns is missing
  2011-06-29 15:52 [Bug c/49581] New: [trans-mem] save/restore of thread-local data in nested txns is missing 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
@ 2012-01-31 13:27 ` torvald at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: torvald at gcc dot gnu.org @ 2012-01-31 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

torvald at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from torvald at gcc dot gnu.org 2012-01-31 13:12:59 UTC ---
Yes, this works now.  Closing it as fixed.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-01-31 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-29 15:52 [Bug c/49581] New: [trans-mem] save/restore of thread-local data in nested txns is missing 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
2012-01-31 13:27 ` torvald at gcc dot gnu.org

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).