https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128395
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <[email protected]>: https://gcc.gnu.org/g:2ba457c92c75129f652174aecf2e002e0bddc463 commit r17-6476-g2ba457c92c75129f652174aecf2e002e0bddc463 Author: Stian Halseth <[email protected]> Date: Fri Nov 20 00:25:18 2026 +0100 SPARC: Do not load from the frame in the delay slot of return The delay slot of the V9 return instruction is executed after the register window has been restored, so a load from the function's own frame placed there reads below the stack pointer, and a trap or a signal taken on that instruction overwrites what it reads. gcc/ PR target/128395 * config/sparc/sparc.cc (eligible_for_restore_insn): Remove RETURN_P parameter and accept any instruction on entry. (eligible_for_return_delay): Simplify and adjust calls to epilogue_renumber and eligible_for_restore_insn. (eligible_for_sibcall_delay): Simplify and adjust call to eligible_for_restore_insn. (output_return): Adjust calls to epilogue_renumber. (epilogue_renumber): Return a boolean, rename TEST parameter into TEST_ONLY and add SET_DEST parameter. <SET>: New case. <MEM>: Reject all loads if the current function has a frame. gcc/testsuite/ * gcc.target/sparc/return-delay-mem.c: New test. Co-authored-by: Eric Botcazou <[email protected]>
