This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/47270] New: [4.4/4.5/4.6 Regression] GCC produces unnecessary/wrong code on -O2 and -O3 levels


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
[...]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]