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

--- Comment #2 from Lukas Grätz <lukas.gra...@tu-darmstadt.de> ---
(In reply to Andrew Pinski from comment #1)
> No I think you are looking into the wrong location.
> 
> When a call happens, it pushes a value on the stack aligning the stack that
> is incoming into that function.
> 
> In the case of GCC 11.3 and above, there is inlining happening.

Well, I could be mistaken. But I couldn't see the inlining.

In GCC 11.3 and above I get something like:
======================
dlist_free_original.constprop.0:
        push    rbp
        push    rbx
...
        sub     rsp, 8
...
        call    do_line
======================

In GCC 11.2 and below it is something like:
=====================
dlist_free_original.constprop.0:
        push    rbp
...
        push    rbx
...
        call    do_line
===================

And I checked with the gdb debugger that the rsp is indeed misaligned at the
start of do_line(). The alignment was OK at the start of
"dlist_free_original.constprop.0".

======================
$ gdb busybox_unstripped
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
...
(gdb) break dlist_free_original.constprop.0
Breakpoint 1 at 0x59a7ac
(gdb) break do_line
Breakpoint 2 at 0x59a474
(gdb) run patch -R -i input.patch

Breakpoint 1, 0x000000000059a7ac in dlist_free_original.constprop ()
(gdb) i r rsp
rsp            0x7fffffffd998      0x7fffffffd998
(gdb) c
Continuing.

Breakpoint 2, 0x000000000059a474 in do_line ()
(gdb) i r rsp
rsp            0x7fffffffd980      0x7fffffffd980
======================

Reply via email to