https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93079
--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> --- We rewrite VAR_DECL to invalid tree code by gimple_set_plf (gdb) p ((tree)0x7fffeccfba20).base.code $22 = VAR_DECL (gdb) c Continuing. Hardware watchpoint 1: *$13 Old value = 17039395 New value = 17041443 gimple_set_plf (stmt=0x7fffeccfba20, plf=GF_PLF_1, val_p=true) at ../../gcc/gimple.h:2013 2013 } (gdb) p ((tree)0x7fffeccfba20).base.code $23 = 2083 (gdb) p *stmt $24 = {code = GIMPLE_OMP_SINGLE, no_warning = 0, visited = 0, nontemporal_move = 0, plf = 1, modified = 0, has_volatile_ops = 0, pad = 0, subcode = 260, uid = 66, location = 3 973026632, num_ops = 32767, bb = 0x0, next = 0x42b8e19de7d87, prev = 0x7ffff5de8d00} (gdb) bt #0 gimple_set_plf (stmt=0x7fffeccfba20, plf=GF_PLF_1, val_p=true) at ../../gcc/gimple.h:2013 #1 0x000000000143fa9e in mark_operand_necessary (op=0x7fffe8700620) at ../../gcc/tree-ssa-dce.c:186 #2 0x0000000001440f94 in propagate_necessity (aggressive=true) at ../../gcc/tree-ssa-dce.c:843 #3 0x00000000014430ca in perform_tree_ssa_dce (aggressive=true) at ../../gcc/tree-ssa-dce.c:1663 #4 0x000000000144320b in tree_ssa_cd_dce () at ../../gcc/tree-ssa-dce.c:1707 #5 0x0000000001443375 in (anonymous namespace)::pass_cd_dce::execute (this=0x32465c0) at ../../gcc/tree-ssa-dce.c:1772 #6 0x0000000001179f2d in execute_one_pass (pass=0x32465c0) at ../../gcc/passes.c:2500 #7 0x000000000117a252 in execute_pass_list_1 (pass=0x32465c0) at ../../gcc/passes.c:2588 #8 0x000000000117a283 in execute_pass_list_1 (pass=0x3246110) at ../../gcc/passes.c:2589 #9 0x000000000117a2db in execute_pass_list (fn=0x7fffeccdbd10, pass=0x3245f90) at ../../gcc/passes.c:2599 #10 0x00000000011782e3 in do_per_function_toporder (callback=0x117a29e <execute_pass_list(function*, opt_pass*)>, data=0x3245f90) at ../../gcc/passes.c:1724 #11 0x000000000117aece in execute_ipa_pass_list (pass=0x3245f30) at ../../gcc/passes.c:2932 #12 0x0000000000cbd3e1 in ipa_passes () at ../../gcc/cgraphunit.c:2604 #13 0x0000000000cbd7a1 in symbol_table::compile (this=0x7ffff70e1100) at ../../gcc/cgraphunit.c:2739 #14 0x0000000000cbdd49 in symbol_table::finalize_compilation_unit (this=0x7ffff70e1100) at ../../gcc/cgraphunit.c:2986 #15 0x00000000012ca38c in compile_file () at ../../gcc/toplev.c:483 #16 0x00000000012cd443 in do_compile () at ../../gcc/toplev.c:2269 #17 0x00000000012cd727 in toplev::main (this=0x7fffffffe98e, argc=14, argv=0x7fffffffea88) at ../../gc c/toplev.c:2408 #18 0x0000000002102747 in main (argc=14, argv=0x7fffffffea88) at ../../gcc/main.c:39 This is caused by invalid sharing. The following makes the problem go away for me: Index: ../../gcc/cp/cp-gimplify.c =================================================================== --- ../../gcc/cp/cp-gimplify.c (revision 279724) +++ ../../gcc/cp/cp-gimplify.c (working copy) @@ -534,7 +534,7 @@ cp_gimplify_init_expr (tree *expr_p, gim { gimplify_expr (&to, pre_p, NULL, is_gimple_lvalue, fb_lvalue); replace_placeholders (from, to); - from = split_nonconstant_init (to, from); + from = unshare_expr (split_nonconstant_init (to, from)); cp_genericize_tree (&from, false); *expr_p = from; return;