[Bug c++/127173] [c++] Segfault with fno-enforce-eh-specs on a function with noexcept and a contract
saaadhu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 1 09:01:38 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127173
--- Comment #1 from Senthil Kumar Selvaraj <saaadhu at gcc dot gnu.org> ---
Debugging shows that contracts.cc:1370 assumes expr_first (DECL_SAVED_TREE
(fndecl)) must be a MUST_NOT_THROW_EXPR expr. That is true if
flag_enforce_eh_specs
is true.
With -fno-enforce-eh-specs, that flag is false, and because
decl.cc:use_eh_spec_block then returns false, begin_eh_spec_block doesn't get
to wrap the function body in a MUST_NOT_THROW_EXPR, triggering the crash.
More information about the Gcc-bugs
mailing list