[Bug c/32680] New: unneeded movsbl

romikb at mail dot ru gcc-bugzilla@gcc.gnu.org
Sun Jul 8 20:26:00 GMT 2007

Code compiled with -O2 -fomit-frame-pointer

char function1(){ return 10; }
char (*pfunc)() = function1;
char function2(){ return pfunc(); }

produce unneeded movsbl instruction:

        subl    $12, %esp << unneeded
        call    *_pfunc
        addl    $12, %esp << unneeded
        movsbl  %al,%eax << unneeded

eax register allready contains char and don't need to be converted.

Code for

long function1(){ return 10; }
long (*pfunc)() = function1;
lonf function2(){ return pfunc(); }

looks fine.

           Summary: unneeded movsbl
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: romikb at mail dot ru


More information about the Gcc-bugs mailing list