https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129156
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Lili Cui <[email protected]>: https://gcc.gnu.org/g:804c0a04557c75997cbb131d43f075dc78a01efa commit r17-7153-g804c0a04557c75997cbb131d43f075dc78a01efa Author: Lili Cui <[email protected]> Date: Fri Dec 4 13:32:25 2026 +0800 x86: Fix separate shrink wrap missing stack clash probe with red zone [PR129156] When a function uses both the red zone and separate shrink wrapping, ix86_expand_prologue allocates the whole frame in the red-zone register save path. The allocation therefore does not go through the common allocation path and misses the ix86_adjust_stack_and_probe check, so no probe is emitted. Remove that allocation and restore the setting of red_zone_used. This makes two changes, shown here for the new test with -fstack-clash-protection: 1. The registers saved in the main prologue are now stored in the red zone with a mov before the stack adjustment, like other functions on this path. 2. The frame is allocated by the common code, so the stack clash probe (orb) is now emitted. Before: subq $4104, %rsp movq %r12, 4088(%rsp) After: movq %r12, -16(%rsp) <-- 1. red-zone mov before the sub subq $4096, %rsp orb $0, (%rsp) <-- 2. stack clash probe subq $8, %rsp gcc/ChangeLog: PR target/129156 * config/i386/i386.cc (ix86_expand_prologue): Remove the frame allocation for separate shrink wrapping from the red-zone register save path. Set red_zone_used there. gcc/testsuite/ChangeLog: PR target/129156 * gcc.target/i386/pr129156.c: New test.
