This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/47270] New: [4.4/4.5/4.6 Regression] GCC produces unnecessary/wrong code on -O2 and -O3 levels
- From: "d.g.gorbachev at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Jan 2011 15:45:44 +0000
- Subject: [Bug rtl-optimization/47270] New: [4.4/4.5/4.6 Regression] GCC produces unnecessary/wrong code on -O2 and -O3 levels
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47270
Summary: [4.4/4.5/4.6 Regression] GCC produces
unnecessary/wrong code on -O2 and -O3 levels
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: d.g.gorbachev@gmail.com
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
$ cat > testcase.c
register int r asm("esi");
void foo(void)
{
if (r)
__asm__("sar\t%0" : "+r" (r));
__asm__("sar\t%0" : "+r" (r));
}
^D
$ gcc -O2 -S testcase.c
$ cat testcase.s
[...]
foo:
.LFB0:
xorl %eax, %eax
testl %esi, %esi
je .L2
#APP
# 6 "testcase.c" 1
sar %esi
# 0 "" 2
#NO_APP
movl %esi, %eax
.L2:
movl %eax, %esi
#APP
# 8 "testcase.c" 1
sar %esi
# 0 "" 2
#NO_APP
ret
[...]