public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/56140] New: GCC inlines incorrect function in __transaction_relaxed
@ 2013-01-29 15:14 srdjan.stipic at gmail dot com
2013-02-15 19:46 ` [Bug middle-end/56140] " aldyh at gcc dot gnu.org
2013-02-21 20:36 ` aldyh at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: srdjan.stipic at gmail dot com @ 2013-01-29 15:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56140
Bug #: 56140
Summary: GCC inlines incorrect function in
__transaction_relaxed
Classification: Unclassified
Product: gcc
Version: trans-mem
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: srdjan.stipic@gmail.com
Created attachment 29301
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29301
Test case.
BUG: GCC inlines tm_clone function in serial irrevocable transaction.
This is incorrect and causes the slowdown of irrevocable transactions.
The correct behavior it to inline non-instrumented function.
The bug is present in 4.7.2 and 4.8 (gcc version 4.8.0 20130129)
when compiling with -O1, -O2, -O3.
// examle.c
int a;
__attribute__((noinline))
void g() {
asm("");
}
__attribute__((noinline))
void f1() {
a++;
}
inline
void f2() {
a++;
}
int main() {
__transaction_relaxed {
g(); // start transaction in irrevocable mode
f1();
f2(); // BUG: compiler inlines tm_clone of f2()
// BUG FIX: compiler should inline original f2()
}
return 0;
}
Generated code:
g():
ret
f1():
addl $1, a(%rip)
ret
f2():
addl $1, a(%rip)
ret
main:
subq $8, %rsp
movl $74, %edi
xorl %eax, %eax
call _ITM_beginTransaction
call g()
call f1()
movl $a, %edi
call _ITM_RfWU4
leal 1(%rax), %esi
movl $a, %edi
call _ITM_WaWU4
call _ITM_commitTransaction
xorl %eax, %eax
addq $8, %rsp
ret
a:
.zero 4
Compiled with:
~# gcc-4.7 -v -O1 example.c -fgnu-tm -c
Using built-in specs.
COLLECT_GCC=gcc-4.7
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.2-5ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-5ubuntu1)
COLLECT_GCC_OPTIONS='-v' '-O1' '-fgnu-tm' '-c' '-mtune=generic' '-march=x86-64'
'-pthread'
/usr/lib/gcc/x86_64-linux-gnu/4.7/cc1 -quiet -v -imultiarch x86_64-linux-gnu
-D_REENTRANT example.c -quiet -dumpbase example.c -mtune=generic -march=x86-64
-auxbase example -O1 -version -fgnu-tm -fstack-protector -o /tmp/ccC3mWQQ.s
GNU C (Ubuntu/Linaro 4.7.2-5ubuntu1) version 4.7.2 (x86_64-linux-gnu)
compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.0-p3,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C (Ubuntu/Linaro 4.7.2-5ubuntu1) version 4.7.2 (x86_64-linux-gnu)
compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.0-p3,
MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: fbb4af59dce4dce949ee30395742b8d0
COLLECT_GCC_OPTIONS='-v' '-O1' '-fgnu-tm' '-c' '-mtune=generic' '-march=x86-64'
'-pthread'
as -v --64 -o example.o /tmp/ccC3mWQQ.s
GNU assembler version 2.22.90 (x86_64-linux-gnu) using BFD version (GNU
Binutils for Ubuntu) 2.22.90.20120924
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-O1' '-fgnu-tm' '-c' '-mtune=generic' '-march=x86-64'
'-pthread'
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug middle-end/56140] GCC inlines incorrect function in __transaction_relaxed
2013-01-29 15:14 [Bug c/56140] New: GCC inlines incorrect function in __transaction_relaxed srdjan.stipic at gmail dot com
@ 2013-02-15 19:46 ` aldyh at gcc dot gnu.org
2013-02-21 20:36 ` aldyh at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: aldyh at gcc dot gnu.org @ 2013-02-15 19:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56140
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot |aldyh at gcc dot gnu.org
|gnu.org |
--- Comment #1 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2013-02-15 19:46:13 UTC ---
Mine.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug middle-end/56140] GCC inlines incorrect function in __transaction_relaxed
2013-01-29 15:14 [Bug c/56140] New: GCC inlines incorrect function in __transaction_relaxed srdjan.stipic at gmail dot com
2013-02-15 19:46 ` [Bug middle-end/56140] " aldyh at gcc dot gnu.org
@ 2013-02-21 20:36 ` aldyh at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: aldyh at gcc dot gnu.org @ 2013-02-21 20:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56140
Aldy Hernandez <aldyh at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2013-02-21 20:35:40 UTC ---
With my patch for PR56108, since this transaction is obviously irrevocable, we
will no longer instrument the inlined code, thus fixing this PR as well.
Fixed in trunk.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-21 20:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 15:14 [Bug c/56140] New: GCC inlines incorrect function in __transaction_relaxed srdjan.stipic at gmail dot com
2013-02-15 19:46 ` [Bug middle-end/56140] " aldyh at gcc dot gnu.org
2013-02-21 20:36 ` aldyh 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).