https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104031
--- Comment #4 from Sergei Trofimovich <slyfox at gcc dot gnu.org> --- Great test, Andrew! Something is completely dropped initialization of Info{} input argument to s_op. As if it's lifetime ends before RegisterPrimOp{} enters: --- main.s.good 2022-01-14 21:53:42.334571321 +0000 +++ main.s.bad 2022-01-14 21:53:51.275722971 +0000 @@ -43,26 +43,25 @@ .p2align 4 .type _GLOBAL__sub_I_main, @function _GLOBAL__sub_I_main: .LFB14: .cfi_startproc subq $24, %rsp #, .cfi_def_cfa_offset 32 # ../main.cc:21: }); movl $_ZL4s_op, %edi #, leaq 8(%rsp), %rsi #, tmp84 - movl $0, 12(%rsp) #, D.2496.arityD.2380 call _ZN14RegisterPrimOpC1E4Info # # ../main.cc:22: int main() {} addq $24, %rsp #, .cfi_def_cfa_offset 8 ret .cfi_endproc .LFE14: .size _GLOBAL__sub_I_main, .-_GLOBAL__sub_I_main .section .init_array,"aw" .align 8 .quad _GLOBAL__sub_I_main .local _ZL4s_op .comm _ZL4s_op,1,1 - .ident "GCC: (GNU) 11.2.0" + .ident "GCC: (GNU) 12.0.0 20220109 (experimental)" .section .note.GNU-stack,"",@progbits Initial gimple looks valid to me: main.cc.006t.gimple: void __static_initialization_and_destruction_0 (int __initialize_p, int __priority) { struct InfoD.2399 D.2453 = {.arityD.2402=0}; ... _ZN6vectorC1EvD.2377 (&D.2453.argsD.2401); ... try { try { try { # USE = anything # CLB = anything _ZN14RegisterPrimOpC1E4InfoD.2413 (&s_opD.2424, &D.2453); } finally { # USE = anything # CLB = anything _ZN4InfoD1EvD.2457 (&D.2453); } } finally { D.2453 = {CLOBBER}; } Final tree also looks ok: main.cc.250t.optimized: voidD.48 _GLOBAL__sub_I_mainD.2486 () { struct InfoD.2399 D.2522 = {.arityD.2402=0}; # USE = nonlocal escaped { D.2424 D.2522 } (nonlocal, escaped) # CLB = nonlocal escaped { D.2424 D.2522 } (nonlocal, escaped) _ZN14RegisterPrimOpC1E4InfoD.2413 (&_ZL4s_opD.2424, &D.2522); D.2522 ={v} {CLOBBER}; First RTL seems to lack the assignment: main.cc.252r.expand: ;; Function _GLOBAL__sub_I_main (_GLOBAL__sub_I_main, funcdef_no=14, decl_uid=2486, cgraph_uid=15, symbol_order=15) (executed once) ... ;; ;; Full RTL generated for this function: ;; 1: NOTE_INSN_DELETED 3: NOTE_INSN_BASIC_BLOCK 2 2: NOTE_INSN_FUNCTION_BEG 5: {r82:DI=r77:DI-0x8;clobber flags:CC;} 6: si:DI=r82:DI 7: di:DI=`_ZL4s_op' 8: call [`_ZN14RegisterPrimOpC1E4Info'] argc:0 REG_CALL_DECL `_ZN14RegisterPrimOpC1E4Info' REG_EH_REGION 0