On Tue, Sep 09, 2025 at 04:52:08PM +0200, Jason Merrill wrote: > > Ok. I wonder whether to keep adding CLOBBER (bob) as before to the start > > of some of the ctors for -std=c++23 and earlier (unless > > -ftrivial-auto-var-init= is specified). The current patch does that. If we > > stop doing that, we'd need to emit also CLOBBER (bob) before the calls to > > full object constructors for -flifetime-dse=2. > > I had been thinking to do that at the same place as/instead of > -ftrivial-auto-var-init when =unitialized.
I guess we could, but the question is if we want to change behavior for C and other languages by default. -flifetime-dse= is apparently currently used solely in the C++ FE but declared in gcc/common.opt: common.opt:Common Var(flag_lifetime_dse,2) Init(2) Optimization common.opt:Common Joined RejectNegative UInteger Var(flag_lifetime_dse) Optimization IntegerRange(0, 2) cp/ChangeLog-2016: flag_lifetime_dse > 1. cp/call.cc: if (!flag_lifetime_dse) cp/decl.cc: && (flag_lifetime_dse > 1) cp/decl.cc: if (flag_lifetime_dse cp/init.cc: = (std_placement && !*init && flag_lifetime_dse > 1 So, if the gimplifier instrumented the starts of vars and TARGET_EXPR_SLOTs for flag_lifetime_dse > 1, it would do that for C etc. as well. One option would be to keep -flifetime-dse switch declaration in the middle end, but change its default to 0 and only set it by default to 2 for C++/ObjC++. The other option is just to do if for flag_lifetimse_dse > 1 without further changes, after all, the main problematic case for users why they'd like to turn it off are mainly new expressions and the addition of the clobber there will be in the FE. > True, the above transformation works for switch or goto from outside the > scope of 't', but from within the scope of 't' you want them to jump to > 'skip'. We would need check_previous_goto to be able to fix up a previous > goto to jump to the right label. I should have something working at least for forward gotos by tomorrow. Jakub