https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111107
--- Comment #39 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> What's the difference between the `-mstackrealign` option and the
> `force_align_arg_pointer` attribute?
-mstackrealign (ix86_force_align_arg_pointer) is only used here:
/* In 32bit, use MIN_STACK_BOUNDARY for incoming stack boundary
if -mstackrealign is used, it isn't used for sibcall check and
estimated stack alignment is 128bit. */
else if (!sibcall
&& ix86_force_align_arg_pointer
&& crtl->stack_alignment_estimated == 128)
incoming_stack_boundary = MIN_STACK_BOUNDARY;
force_align_arg_pointer works for any alignment, not just 128-bit.
> I'm quite confused by `-mstackrealign`: It could mean to realign the stack
> either to the preferred alignment (of every function), or to the required
> alignment, or just to at least 16 bytes. Without the final patch, the
> preferred alignment is 16 bytes, but unless a local variable requires
> 16-byte alignment, no stack realignment actually happens; even when a local
> variable requires 8-byte alignment (comment #23), the stack is still not
> aligned to an 8-byte boundary.
In practice -mstackrealign forces stack alignment to 16-byte (because it's the
preferred alignment) of every function that requires 16-byte alignment. So it
has no effects for 8-byte alignment, but that's mostly OK in practice.