https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111107
--- Comment #25 from Zeb Figura <zfigura at codeweavers dot com> --- (In reply to LIU Hao from comment #24) > (In reply to Zeb Figura from comment #23) > > Only partly. The example in the initial code is fixed. However, if you > > change it to aligned(8) instead of aligned(16), it no longer aligns. See > > comment 17. > > > > Using PREFERRED_STACK_BOUNDARY_DEFAULT instead of STACK_REALIGN_DEFAULT > > would have fixed this, but maybe this is supposed to be considered a bug > > with -mstackrealign. I don't know. I've asked multiple times what the > > difference between the two is actually supposed to be, without answer. > > Isn't the answer exactly > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111107#c9 ? That's the difference between -mpreferred-stack-boundary and -mincoming-stack-boundary; I'm asking about -mstackrealign. > In i386-options.cc there's > > ix86_default_incoming_stack_boundary = PREFERRED_STACK_BOUNDARY; > > Would it make any sense to decrease the preferred stack boundary to `32` > (like below)? Maybe it's too late, but Microsoft code has always been > assuming 4-byte alignment, thus a 16-byte alignment is always unpredictable. > > #undef PREFERRED_STACK_BOUNDARY_DEFAULT > #define PREFERRED_STACK_BOUNDARY_DEFAULT \ > (TARGET_64BIT ? 128 : MIN_STACK_BOUNDARY) Yes, that's what I would advocate for. gcc should assume 4-byte alignment and it should preserve 4-byte alignment.