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

LIU Hao <lh_mouse at 126 dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lh_mouse at 126 dot com

--- Comment #46 from LIU Hao <lh_mouse at 126 dot com> ---
(In reply to John Platts from comment #28)
> The correct way to align the stack to a 32-byte or 64-byte boundary on
> 64-bit Windows is to use a frame pointer in a function that requires stack
> realignment and then realign the stack to the required alignment once the
> frame pointer is set and all of the non-volatile registers used in the
> function are saved.
> 

Please don't suggest that. There's assumption that `QWORD PTR [rbp]` points to
the previous frame, and in your code it would be `QWORD PTR [rbp + 8 * 2]`.

Here's Microsoft doc:
https://learn.microsoft.com/en-us/cpp/build/prolog-and-epilog?view=msvc-170#epilog-code

They use `r13` as the frame pointer but anyway, an epilogue must start with
either `add rsp, <constant>` or `lea rsp, [rbp + <constant>]`, followed by a
sequence of zero or more `pop`s, followed by either `ret` or `jmp` (indirect
jumps require REX prefixes). By this definition, the difference between `rsp`
and `rbp` is a fixed value. Since `rsp` can only be subtracted by a constant
value in the prologue, we can't change `rbp` otherwise.

Reply via email to