https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105257
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 52830 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52830&action=edit gcc12-pr105257.patch Untested fix. The problem is that (reg:DI 24 %i0 [109]) in a delay slot of the return satisfies sparc_pic_register_p but epilogue_renumber turns that into: (reg:DI 8 %o0) which doesn't satisfy it. The attached patch fixes that by always copying over ORIGINAL_REGNO. A variant could be to do that only if ORIGINAL_REGNO is non-zero, if it is zero, keep using gen_reg_RTX (which can create a shared rtx and therefore shouldn't have ORIGINAL_REGNO modified).