Take the following example:
int main1(void);

int main(void)
{
  return main1();
}
----
With 3.4.0, we got at -O2:
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        subl    $16, %esp
        call    main1
        leave
        ret

While with 4.0.0 and above we get:
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp
        subl    $16, %esp
        leave
        jmp     main1
        .size   main, .-main

This is wrong, we should not be sibcalling optimizing in main at all.


-- 
           Summary: [4.0/4.1 Regression] Sibcalling optimization is
                    happening in main
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: i?86-*-*


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

Reply via email to