https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87370

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to trashyankes from comment #10)
> (In reply to H.J. Lu from comment #9)
> > Fixed for GCC 9, GCC 8.3 and GCC 7.4.
> 
> One question, I look on test case and see:
> 
> ```
> f1():
>         xor     eax, eax
>         xor     edx, edx
>         ret
> f2():
>         push    rbp
>         xor     eax, eax
>         xor     edx, edx
>         mov     rbp, rsp
>         and     rsp, -64
>         sub     rsp, 8
>         leave
>         ret
> f3():
>         xor     eax, eax
>         xor     edx, edx
>         ret
> ```
> 
> Why `f2` have `push` there? Isn't this co kind of stack alignment? but for
> what point is it there? Clang do not have that.

Which GCC are you using? GCC 8.2 generates:

        .file   "pr87370.c"
        .text
        .p2align 4,,15
        .globl  f1
        .type   f1, @function
f1:
.LFB0:
        .cfi_startproc
        xorl    %eax, %eax
        xorl    %edx, %edx
        ret
        .cfi_endproc
.LFE0:
        .size   f1, .-f1
        .p2align 4,,15
        .globl  f2
        .type   f2, @function
f2:
.LFB1:
        .cfi_startproc
        xorl    %eax, %eax
        xorl    %edx, %edx
        ret
        .cfi_endproc
.LFE1:
        .size   f2, .-f2
        .p2align 4,,15
        .globl  f3
        .type   f3, @function
f3:
.LFB2:
        .cfi_startproc
        xorl    %eax, %eax
        xorl    %edx, %edx
        ret
        .cfi_endproc
.LFE2:
        .size   f3, .-f3

Reply via email to