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

           Summary: [trans-mem] thread-local memory variable not properly
                    logged
           Product: gcc
           Version: trans-mem
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: r...@gcc.gnu.org


extern void baz(int);
int y;
void foo(volatile int x)
{
  __transaction {
    x += y;
    y++;
  }
  baz(x);
}

Ignore the fact that volatile is not really compatible with
transactional memory; it is used here only to force the 
compiler to put X into memory without having to generate a
much more complex test case.

It currently compiles to 

        call    _ITM_beginTransaction
        movl    12(%rsp), %ebx
        movl    $y, %edi
        call    _ITM_RfWU4
        leal    1(%rax), %esi
        movl    $y, %edi
        leal    (%rax,%rbx), %ebx
        movl    %ebx, 12(%rsp)
        call    _ITM_WaWU4
        call    _ITM_commitTransaction

Note that X, at %rbp+12, is written back to memory and is
not logged.  If the either the write or commit functions
have to restart the transaction, we will produce the wrong
answer.

Reply via email to