[Bug target/60520] New: stack adjustment are not merged anymore

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 13 21:26:00 GMT 2014


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

            Bug ID: 60520
           Summary: stack adjustment are not merged anymore
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com

Following testcase:

--cut here--
extern void foo (int *);
extern int *bar;

void test (void)
{
  if (*bar)
    foo (bar);
}
--cut here--

compiles with gcc-4.9 to (-O2 -m32):

test:
        movl    bar, %eax
        movl    (%eax), %edx
        testl   %edx, %edx
        jne     .L7
        ret
        .p2align 4,,10
        .p2align 3
.L7:
        subl    $24, %esp
        pushl   %eax
        call    foo
        addl    $16, %esp      <<<
        addl    $12, %esp      <<<
        ret

A single "addl $28, %esp" should be emitted here, as is the case with gcc-4.8:

test:
        movl    bar, %eax
        movl    (%eax), %edx
        testl   %edx, %edx
        jne     .L7
        ret
        .p2align 4,,7
        .p2align 3
.L7:
        subl    $28, %esp
        movl    %eax, (%esp)
        call    foo
        addl    $28, %esp     <<<
        ret



More information about the Gcc-bugs mailing list