https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120424
Bug ID: 120424 Summary: [arm] -fnon-call-exceptions -fstack-clash-protection triggers lra-eliminations bug Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: aoliva at gcc dot gnu.org Reporter: aoliva at gcc dot gnu.org Target Milestone: --- Created attachment 61514 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61514&action=edit testcase regresses on arm-eabi, arm-linux-gnu, arm-vx7r2, ... starting at gcc 14 The attached C++ testcase triggers the problem. It's rewritten in C++ from libgnat (where -fnon-call-exceptions is enabled by default, and -fstack-clash-protection is enabled explicitly). I don't know yet whether C++ is essential, but the throw appears to be needed to trip the issue. g() has an empty frame until reload spills a register that needs to survive a function call. That spilling flips arm_frame_pointer_required from false to true, so lra_update_fp2sp_elimination proceeds to disable that elimination possibility, and ultimately we fail to adjust the spill stack slot's negative offset, so it remains below the stack pointer. The workaround is to disable the size == 0 frame pointer optimization. I'm still investigating towards a proper fix.