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 c/41749] New: non-needed instructions are not removed (not optimized)


int main (void) {    return 1; }

Ubuntu Jaunty.

gcc --save-temps -fno-stack-protector -fomit-frame-pointer -Os ./cpuid.c

generates thgis:
--------------
main:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        movl    $1, %eax
        pushl   %ecx
        popl    %ecx
        leal    -4(%ecx), %esp
        ret
--------------------------
why i get this:
        pushl   %ecx
        popl    %ecx
and other non-needed instructions (for another example)
pushl   %ebp
andl    $1, %eax
movl    %esp, %ebp
pushl   %ecx
popl    %ecx
popl    %ebp

These instructions are not optimized not in -O3, nor in -Os


-- 
           Summary: non-needed instructions are not removed (not optimized)
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: socketpair at gmail dot com


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


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