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

--- Comment #4 from Luke Dalessandro <luked at cs dot rochester.edu> 2012-05-03 
15:06:57 UTC ---
Created attachment 27303
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27303
RBTree microbenchmark test case

I believe that I'm seeing this in the RSTM suite's RBTree microbenchmark as
well. It appears to be manifesting with the same symptoms as pr47530,
_ITM_commitTransaction is generated as a tail call. An abort in
_ITM_commitTransaction during multithreaded execution corrupts the stack slot
that is used to hold a "time" value.

I attached the TreeBench.ii test case so that a second, complex example of the
problem exists.

Static manifestation of bug is "jmp _ITM_commitTransaction" in asm output.

$ g++ -O3 -fgnu-tm -o /dev/stdout -S TreeBench.ii | grep _ITM_commitTransaction 
    call    _ITM_commitTransaction
    jmp    _ITM_commitTransaction
    jmp    _ITM_commitTransaction

Runtime manifestation is corrupted "time" output (and thus "throughput" output
as well) under multithreaded execution ("p" command line parameter) of the
optimized executable.

$ g++ -fgnu-tm -o TreeBench TreeBench.ii -lrt
$ ./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=1251624,
time=1000001773, throughput=1251621

$ g++ -O3 -fgnu-tm -o TreeBench TreeBench.ii -lrt
$ ./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=391668795, time=1336057254755574655, throughput=0

Output from g++ -v -save-temps.

$ g++ -fgnu-tm -O3 -m64 -DSTM_INST_STM -DSTM_API_GCCTM -DSTM_CC_GCC
-DSTM_OS_LINUX -DSTM_CPU_X86 -DSTM_BITS_64 -DSTM_OPT_O3 -DSTM_WS_BYTELOG
-DSINGLE_SOURCE_BUILD -I../include -I../lib -v -save-temps TreeBench.cpp -lrt
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/localdisk/luked/pub/gcc/4.8/bin/../libexec/gcc/x86_64-redhat-linux/4.8.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../gcc-4.8/configure --prefix=/u/luked/pub/gcc/4.8
--enable-bootstrap --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-__cxa-atexit --disable-libunwind-exceptions
--enable-linker-build-id --enable-plugins --enable-lto --disable-nls
--enable-ld --enable-gold --with-gmp=/u/luked/pub/gmp-5.0.4-static
--with-mpfr=/u/luked/pub/mpfr-3.1.0-static
--with-mpc=/u/luked/pub/mpc-0.9-static
--with-ppl=/u/luked/pub/ppl-0.11.2-static
--with-cloog=/u/luked/pub/cloog-0.16.3-static --enable-cloog-backend=isl
--with-tune=generic --with-arch-32=i686 --with-gnu-ld --with-gnu-as
--with-plugin-ld=ld.gold --build=x86_64-redhat-linux
--with-host-libstdcxx='/usr/local/lib64/libstdc++.a -lm'
--enable-languages=c,c++,lto : (reconfigured) 
Thread model: posix
gcc version 4.8.0 20120502 (experimental) [trunk revision 187050] (GCC) 
COLLECT_GCC_OPTIONS='-fgnu-tm' '-O3' '-m64' '-D' 'STM_INST_STM' '-D'
'STM_API_GCCTM' '-D' 'STM_CC_GCC' '-D' 'STM_OS_LINUX' '-D' 'STM_CPU_X86' '-D'
'STM_BITS_64' '-D' 'STM_OPT_O3' '-D' 'STM_WS_BYTELOG' '-D'
'SINGLE_SOURCE_BUILD' '-I' '../include' '-I' '../lib' '-v' '-save-temps'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'

/localdisk/luked/pub/gcc/4.8/bin/../libexec/gcc/x86_64-redhat-linux/4.8.0/cc1plus
-E -quiet -v -I ../include -I ../lib -iprefix
/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/
-D_GNU_SOURCE -D_REENTRANT -D STM_INST_STM -D STM_API_GCCTM -D STM_CC_GCC -D
STM_OS_LINUX -D STM_CPU_X86 -D STM_BITS_64 -D STM_OPT_O3 -D STM_WS_BYTELOG -D
SINGLE_SOURCE_BUILD TreeBench.cpp -m64 -mtune=generic -march=x86-64 -fgnu-tm
-O3 -fpch-preprocess -o TreeBench.ii
ignoring nonexistent directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../x86_64-redhat-linux/include"
ignoring duplicate directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../include/c++/4.8.0"
ignoring duplicate directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../include/c++/4.8.0/x86_64-redhat-linux"
ignoring duplicate directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../include/c++/4.8.0/backward"
ignoring duplicate directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.8.0/include"
ignoring duplicate directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.8.0/include-fixed"
ignoring nonexistent directory
"/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 ../include
 ../lib

/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../include/c++/4.8.0

/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../include/c++/4.8.0/x86_64-redhat-linux

/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../include/c++/4.8.0/backward
 /localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/include

/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/include-fixed
 /usr/local/include
 /localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/../../include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-fgnu-tm' '-O3' '-m64' '-D' 'STM_INST_STM' '-D'
'STM_API_GCCTM' '-D' 'STM_CC_GCC' '-D' 'STM_OS_LINUX' '-D' 'STM_CPU_X86' '-D'
'STM_BITS_64' '-D' 'STM_OPT_O3' '-D' 'STM_WS_BYTELOG' '-D'
'SINGLE_SOURCE_BUILD' '-I' '../include' '-I' '../lib' '-v' '-save-temps'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'

/localdisk/luked/pub/gcc/4.8/bin/../libexec/gcc/x86_64-redhat-linux/4.8.0/cc1plus
-fpreprocessed TreeBench.ii -quiet -dumpbase TreeBench.cpp -m64 -mtune=generic
-march=x86-64 -auxbase TreeBench -O3 -version -fgnu-tm -o TreeBench.s
GNU C++ (GCC) version 4.8.0 20120502 (experimental) [trunk revision 187050]
(x86_64-redhat-linux)
    compiled by GNU C version 4.8.0 20120502 (experimental) [trunk revision
187050], GMP version 5.0.4, MPFR version 3.1.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.8.0 20120502 (experimental) [trunk revision 187050]
(x86_64-redhat-linux)
    compiled by GNU C version 4.8.0 20120502 (experimental) [trunk revision
187050], GMP version 5.0.4, MPFR version 3.1.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c6589865671e480899c2bc410ddd1367
COLLECT_GCC_OPTIONS='-fgnu-tm' '-O3' '-m64' '-D' 'STM_INST_STM' '-D'
'STM_API_GCCTM' '-D' 'STM_CC_GCC' '-D' 'STM_OS_LINUX' '-D' 'STM_CPU_X86' '-D'
'STM_BITS_64' '-D' 'STM_OPT_O3' '-D' 'STM_WS_BYTELOG' '-D'
'SINGLE_SOURCE_BUILD' '-I' '../include' '-I' '../lib' '-v' '-save-temps'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'

/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../x86_64-redhat-linux/bin/as
-v -I ../include -I ../lib --64 -o TreeBench.o TreeBench.s
GNU assembler version 2.22.52 (x86_64-redhat-linux) using BFD version (GNU
Binutils) 2.22.52.20120502
COMPILER_PATH=/localdisk/luked/pub/gcc/4.8/bin/../libexec/gcc/x86_64-redhat-linux/4.8.0/:/localdisk/luked/pub/gcc/4.8/bin/../libexec/gcc/:/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../x86_64-redhat-linux/bin/
LIBRARY_PATH=/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/:/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/:/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../x86_64-redhat-linux/lib/:/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../:/lib/:/usr/lib/
Reading specs from
/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../lib64/libitm.spec
COLLECT_GCC_OPTIONS='-fgnu-tm' '-O3' '-m64' '-D' 'STM_INST_STM' '-D'
'STM_API_GCCTM' '-D' 'STM_CC_GCC' '-D' 'STM_OS_LINUX' '-D' 'STM_CPU_X86' '-D'
'STM_BITS_64' '-D' 'STM_OPT_O3' '-D' 'STM_WS_BYTELOG' '-D'
'SINGLE_SOURCE_BUILD' '-I' '../include' '-I' '../lib' '-v' '-save-temps'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-pthread'

/localdisk/luked/pub/gcc/4.8/bin/../libexec/gcc/x86_64-redhat-linux/4.8.0/collect2
--build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o
/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/crtbegin.o
-L/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0
-L/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc
-L/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../lib64
-L/lib/../lib64 -L/usr/lib/../lib64
-L/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../../../x86_64-redhat-linux/lib
-L/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/../../..
TreeBench.o -lrt -lstdc++ -lm -litm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc
/localdisk/luked/pub/gcc/4.8/bin/../lib/gcc/x86_64-redhat-linux/4.8.0/crtend.o
/usr/lib/../lib64/crtn.o

Reply via email to