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

--- Comment #5 from Luke Dalessandro <luked at cs dot rochester.edu> 2012-05-02 
16:50:41 UTC ---
Created attachment 27288
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27288
Preprocessed RBTree microbenchmark from RSTM that triggers this bug.

I'm still seeing this bug with gcc-4.8 (svn r187050). I've attached a
preprocessed source file from the RSTM microbenchmark suite (for fc13, x86_64)
that manifests the problem. It simply takes an integer set, implemented as an
RBTree, and randomly performs insert/delete/lookup operations as transactions.
The "p" command line parameter sets the number of threads to use. The rest of
the command line parameters aren't relevant.

Unoptimized compilation produces expected output:

luke> g++ -fgnu-tm -o TreeBench TreeBench.i -lrt
luke> ./TreeBench -p2
Verification: Passed
csv, ALG=gcc-tm, B=RBTree, R=34, d=1, p=2, X=0, m=256, S=1, O=1, txns=1231838,
time=1000001329, throughput=1231836

Optimized compilation shows stack corruption ("time" output is computed using a
stack location that is trashed when _ITM_commitTransaction longjmps from the
tail call).

luke> g++ -O3 -fgnu-tm -o TreeBench TreeBench.i -lrt
luke> ./TreeBench -p2
Verification: Passed
csv, ALG=gcc-tm, B=RBTree, R=34, d=1, p=2, X=0, m=256, S=1, O=1,
txns=1301244673, time=1335976459721524108, throughput=0

Tail (sibling?) calls to _ITM_commitTransaction are identified by 'jmp'
instructions.

luke> g++ -O3 -fgnu-tm -o /dev/stdout -S TreeBench.i | grep
_ITM_commitTransaction
    call    _ITM_commitTransaction
    jmp    _ITM_commitTransaction
    jmp    _ITM_commitTransaction


I expect that this is also related to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51771--and in fact may be the same
bug, but it's manifesting as the specific tail-call problem that was noted here
as fixed. The returns_twice "hack" that suppresses pr51771 in gcc-4.7 also
suppresses this bug (pr47530) in gcc-4.7, so it's gcc-4.8-only at this point.

I will reopen pr47530, but if someone can confirm it as really being pr51771
I'm happy to have it closed again.

Reply via email to