https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87944
Stefan "Bebbo" Franke <stefan at franke dot ms> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stefan at franke dot ms --- Comment #4 from Stefan "Bebbo" Franke <stefan at franke dot ms> --- the problem resides in lra-eliminations.c. It starts in void eliminate_regs_in_insn where a simple plus bypasses the stack offset handling: /* If we have a nonzero offset, and the source is already a simple REG, the following transformation would increase the cost of the insn by replacing a simple REG with (plus (reg sp) CST). So try only when we already had a PLUS before. */ if (known_eq (offset, 0) || plus_src) because lra_get_insn_recog_data (insn)->sp_offset is not considered. With the m68k architecture plus using lra you get this problem plus some similar ones, all related to arg / frame / stack pointer conversion with incorrect offsets. I fixed it locally with few more changes in lra-elimintaions.c