Hi Jason, I’m sending the revised patch as part of the complete series which will cross-reference this mail.
> On 17 Jan 2026, at 14:08, Jason Merrill <[email protected]> wrote: > > On 12/1/25 9:50 PM, Iain Sandoe wrote: >> From: Nina Ranns <[email protected]> >> Changes since v1 >> - fixed a merge error in the removal of C++2a code. >> - rebased onto r16-5785-g3b30d09ac7bbf8 (includes change to default to >> C++20). >> +fcontracts-conservative-ipa >> +C++ ObjC++ Var(flag_contracts_conservative_ipa) Init(1) >> +-fcontracts-conservative-ipa Do not allow certain optimisations between >> +functions in contract assertions. > > Why do we want this to be controllable by users? Ville comments: " The CFG edge leading to terminate allows optimizations to propagate forwards. The noipa wrapping disables that. so if you want those optimizations regardless of their dangers, use the option” For my 0.02 GBP what needs doing is fixing the actual problem so that we can remove the work-around (left this option in for now). >> --- a/gcc/cp/contracts.cc >> +++ b/gcc/cp/contracts.cc >> +/* Define a noipa wrapper around the call to std::terminate */ >> + >> +static void build_terminate_wrapper() > > Newline for name Done. >> +get_terminate_wrapper () >> +{ >> + DECL_EXTERNAL (__tu_terminate_wrapper) = false; >> + DECL_WEAK (__tu_terminate_wrapper) = false; > > You likely want to set DECL_INTERFACE_KNOWN as well. Done. > >> + DECL_ATTRIBUTES (__tu_terminate_wrapper) >> + = tree_cons (get_identifier ("noipa"), NULL, NULL_TREE); >> + cplus_decl_attributes (&__tu_terminate_wrapper, >> + DECL_ATTRIBUTES (__tu_terminate_wrapper), 0); >> + build_terminate_wrapper(); > > space FIxed, === END ===
