https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115038
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Eric Botcazou <ebotca...@gcc.gnu.org>: https://gcc.gnu.org/g:f14ef5cfd4c1ba1d34afda9174935e40d3c0a3ce commit r15-776-gf14ef5cfd4c1ba1d34afda9174935e40d3c0a3ce Author: Eric Botcazou <ebotca...@adacore.com> Date: Wed May 22 18:10:39 2024 +0200 Fix internal error in seh_cfa_offset with -O2 -fno-omit-frame-pointer The problem directly comes from the -ffold-mem-offsets pass messing up with the prologue and the frame-related instructions, which is a no-no with SEH, so the fix simply disconnects the pass in these circumstances. gcc/ PR rtl-optimization/115038 * fold-mem-offsets.cc (fold_offsets): Return 0 if the defining instruction of the register is frame related. gcc/testsuite/ * g++.dg/opt/fmo1.C: New test.