https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89330
--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Martin Jambor from comment #10) > Created attachment 46544 [details] > WIP patch > > I have written another patch that removes the edges from the vector at > the time speculation is resolved rather than preventing creation of > the edges in the first place. > > Unfortunately, the patch still trips over the added assert when LTO > bootstrapping D. So we'll have to look into it and find out where the > edges get deleted other than in check_speculations before figuring out > whether this is the right approach or not. Life cycle for edge->callee is: Hardware watchpoint 5: *$2 Old value = <error reading variable: Cannot access memory at address 0xafafafafafafafbf> New value = <cgraph_node * 0x0> symbol_table::create_edge (this=0x7ffff733a100, caller=<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173>, callee=<cgraph_node * 0x0>, call_stmt=0x0, count=..., indir_unknown_callee=true) at ../../gcc/cgraph.c:867 867 edge->prev_caller = NULL; (gdb) bt #0 symbol_table::create_edge (this=0x7ffff733a100, caller=<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173>, callee=<cgraph_node * 0x0>, call_stmt=0x0, count=..., indir_unknown_callee=true) at ../../gcc/cgraph.c:867 #1 0x00000000009d0a32 in cgraph_node::create_indirect_edge (this=<cgraph_node * const 0x7fffc6adc5a0 "accept"/1913173>, call_stmt=0x0, ecf_flags=0, count=..., compute_indirect_info=false) at ../../gcc/cgraph.c:955 #2 0x00000000009ecf92 in cgraph_edge::clone (this=<cgraph_edge* 0x7fffc6a234e0 (<cgraph_node * 0x7fffc6a26000 "accept"/1912982> -> <cgraph_node * 0x0>)>, n=<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173>, call_stmt=0x0, stmt_uid=4, num=..., den=..., update_original=true) at ../../gcc/cgraphclones.c:113 #3 0x00000000009ee828 in cgraph_node::create_clone (this=<cgraph_node * const 0x7fffc6a26000 "accept"/1912982>, new_decl=<function_decl 0x7ffff6ddb600 accept>, prof_count=..., update_original=true, redirect_callers=..., call_duplication_hook=true, new_inlined_to=<cgraph_node * 0x7fffed710708 "argExpTypesToCBuffer"/67208>, args_to_skip=0x0, suffix=0x0) at ../../gcc/cgraphclones.c:502 #4 0x0000000001eb48ea in clone_inlined_nodes (e=<cgraph_edge* 0x7fffc6ad8618 (<cgraph_node * 0x7fffc6adc2d0 "parametersToBuffer"/1913172> -> <cgraph_node * 0x7fffc6a26000 "accept"/1912982>)>, duplicate=true, update_original=true, overall_size=0x3233d30 <_ZL12overall_size>) at ../../gcc/ipa-inline-transform.c:221 #5 0x0000000001eb4996 in clone_inlined_nodes (e=<cgraph_edge* 0x7fffc6ad8618 (<cgraph_node * 0x7fffc6adc2d0 "parametersToBuffer"/1913172> -> <cgraph_node * 0x7fffc6a26000 "accept"/1912982>)>, duplicate=true, update_original=true, overall_size=0x3233d30 <_ZL12overall_size>) at ../../gcc/ipa-inline-transform.c:236 #6 0x0000000001eb4996 in clone_inlined_nodes ( e=<cgraph_edge* 0x7fffc6ad8548 (<cgraph_node * 0x7fffc6adc168 "_ZN18PrettyPrintVisitor24visitFuncIdentWithPrefixEP12TypeFunctionP10IdentifierP19TemplateDeclaration.part.0"/1913171> -> <cgraph_node * 0x7fffc6adc2d0 "parametersToBuffer"/1913172>)>, duplicate=true, update_original=true, overall_size=0x3233d30 <_ZL12overall_size>) at ../../gcc/ipa-inline-transform.c:236 #7 0x0000000001eb4996 in clone_inlined_nodes ( e=<cgraph_edge* 0x7fffc6ad8340 (<cgraph_node * 0x7fffc6ad1e10 "visitFuncIdentWithPrefix"/1913169> -> <cgraph_node * 0x7fffc6adc168 "_ZN18PrettyPrintVisitor24visitFuncIdentWithPrefixEP12TypeFunctionP10IdentifierP19TemplateDeclaration.part.0"/1913171>)>, duplicate=true, update_original=true, overall_size=0x3233d30 <_ZL12overall_size>) at ../../gcc/ipa-inline-transform.c:236 #8 0x0000000001eb4996 in clone_inlined_nodes (e=<cgraph_edge* 0x7fffc6ad2410 (<cgraph_node * 0x7fffc6ac0000 "typeToBuffer"/1913165> -> <cgraph_node * 0x7fffc6ad1e10 "visitFuncIdentWithPrefix"/1913169>)>, duplicate=true, update_original=true, overall_size=0x3233d30 <_ZL12overall_size>) at ../../gcc/ipa-inline-transform.c:236 #9 0x0000000001eb4996 in clone_inlined_nodes (e=<cgraph_edge* 0x7fffc6acad00 (<cgraph_node * 0x7fffc6ace9d8 "visit"/1913164> -> <cgraph_node * 0x7fffc6ac0000 "typeToBuffer"/1913165>)>, duplicate=true, update_original=true, overall_size=0x3233d30 <_ZL12overall_size>) at ../../gcc/ipa-inline-transform.c:236 #10 0x0000000001eb55f3 in inline_call (e=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, update_original=true, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, overall_size=0x3233d30 <_ZL12overall_size>, update_overall_summary=true, callee_removed=0x0) at ../../gcc/ipa-inline-transform.c:477 #11 0x0000000001ea6a68 in inline_small_functions () at ../../gcc/ipa-inline.c:2085 #12 0x0000000001ea85c0 in ipa_inline () at ../../gcc/ipa-inline.c:2547 #13 0x0000000001ea945f in (anonymous namespace)::pass_ipa_inline::execute (this=0x32978f0) at ../../gcc/ipa-inline.c:2955 #14 0x0000000000f0ddff in execute_one_pass (pass=<opt_pass* 0x32978f0 "inline"(84)>) at ../../gcc/passes.c:2473 #15 0x0000000000f0ed7a in execute_ipa_pass_list (pass=<opt_pass* 0x32978f0 "inline"(84)>) at ../../gcc/passes.c:2913 #16 0x00000000008cbf7a in do_whole_program_analysis () at ../../gcc/lto/lto.c:456 #17 0x00000000008cc2a6 in lto_main () at ../../gcc/lto/lto.c:628 #18 0x0000000001073ff8 in compile_file () at ../../gcc/toplev.c:456 #19 0x0000000001076c7a in do_compile () at ../../gcc/toplev.c:2209 #20 0x0000000001076f5a in toplev::main (this=0x7fffffffdf90, argc=1068, argv=0x3267250) at ../../gcc/toplev.c:2344 #21 0x0000000001fd06b9 in main (argc=30, argv=0x7fffffffe098) at ../../gcc/main.c:39 (gdb) c Continuing. Hardware watchpoint 5: *$2 Old value = <cgraph_node * 0x0> New value = <cgraph_node * 0x7fffed70c2d0 "visit"/67188> cgraph_edge::set_callee (this=<cgraph_edge* 0x7fffc6ad8a28 (<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173> -> <cgraph_node * 0x7fffed70c2d0 "visit"/67188>)>, n=<cgraph_node * 0x7fffed70c2d0 "visit"/67188>) at ../../gcc/cgraph.h:3140 3140 } (gdb) bt #0 cgraph_edge::set_callee (this=<cgraph_edge* 0x7fffc6ad8a28 (<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173> -> <cgraph_node * 0x7fffed70c2d0 "visit"/67188>)>, n=<cgraph_node * 0x7fffed70c2d0 "visit"/67188>) at ../../gcc/cgraph.h:3140 #1 0x00000000009d15c4 in cgraph_edge::make_direct (this=<cgraph_edge* 0x7fffc6ad8a28 (<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173> -> <cgraph_node * 0x7fffed70c2d0 "visit"/67188>)>, callee=<cgraph_node * 0x7fffed70c2d0 "visit"/67188>) at ../../gcc/cgraph.c:1254 #2 0x0000000000d3da66 in ipa_make_edge_direct_to_target (ie=<cgraph_edge* 0x7fffc6ad8a28 (<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173> -> <cgraph_node * 0x7fffed70c2d0 "visit"/67188>)>, target=<function_decl 0x7ffff6a07600 visit>, speculative=false) at ../../gcc/ipa-prop.c:2977 #3 0x0000000000d3eef6 in try_make_edge_direct_virtual_call (ie=<cgraph_edge* 0x7fffc6ad8a28 (<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173> -> <cgraph_node * 0x7fffed70c2d0 "visit"/67188>)>, jfunc=0x7fffc6ab4468, ctx=...) at ../../gcc/ipa-prop.c:3397 #4 0x0000000000d3f1af in update_indirect_edges_after_inlining (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3462 #5 0x0000000000d3f553 in propagate_info_to_inlined_callees (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6adc5a0 "accept"/1913173>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3555 #6 0x0000000000d3f58a in propagate_info_to_inlined_callees (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6adc2d0 "parametersToBuffer"/1913172>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3559 #7 0x0000000000d3f58a in propagate_info_to_inlined_callees (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6adc168 "_ZN18PrettyPrintVisitor24visitFuncIdentWithPrefixEP12TypeFunctionP10IdentifierP19TemplateDeclaration.part.0"/1913171>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3559 #8 0x0000000000d3f58a in propagate_info_to_inlined_callees (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6ad1e10 "visitFuncIdentWithPrefix"/1913169>, new_edges=Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: 0x7fffffffdad0) at ../../gcc/ipa-prop.c:3559 #9 0x0000000000d3f58a in propagate_info_to_inlined_callees (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6ac0000 "typeToBuffer"/1913165>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3559 #10 0x0000000000d3f58a in propagate_info_to_inlined_callees (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, node=<cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3559 #11 0x0000000000d3fcaf in ipa_propagate_indirect_call_infos (cs=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-prop.c:3712 #12 0x0000000001eb56a6 in inline_call (e=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, update_original=true, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, overall_size=0x3233d30 <_ZL12overall_size>, update_overall_summary=true, callee_removed=0x0) at ../../gcc/ipa-inline-transform.c:486 #13 0x0000000001ea6a68 in inline_small_functions () at ../../gcc/ipa-inline.c:2085 #14 0x0000000001ea85c0 in ipa_inline () at ../../gcc/ipa-inline.c:2547 #15 0x0000000001ea945f in (anonymous namespace)::pass_ipa_inline::execute (this=0x32978f0) at ../../gcc/ipa-inline.c:2955 #16 0x0000000000f0ddff in execute_one_pass (pass=<opt_pass* 0x32978f0 "inline"(84)>) at ../../gcc/passes.c:2473 #17 0x0000000000f0ed7a in execute_ipa_pass_list (pass=<opt_pass* 0x32978f0 "inline"(84)>) at ../../gcc/passes.c:2913 #18 0x00000000008cbf7a in do_whole_program_analysis () at ../../gcc/lto/lto.c:456 #19 0x00000000008cc2a6 in lto_main () at ../../gcc/lto/lto.c:628 #20 0x0000000001073ff8 in compile_file () at ../../gcc/toplev.c:456 #21 0x0000000001076c7a in do_compile () at ../../gcc/toplev.c:2209 #22 0x0000000001076f5a in toplev::main (this=0x7fffffffdf90, argc=1068, argv=0x3267250) at ../../gcc/toplev.c:2344 #23 0x0000000001fd06b9 in main (argc=30, argv=0x7fffffffe098) at ../../gcc/main.c:39 (gdb) c Continuing. Hardware watchpoint 5: *$2 Old value = <cgraph_node * 0x7fffed70c2d0 "visit"/67188> New value = <cgraph_node * 0x0> 0x00007ffff76862be in __memset_avx2 () from /lib64/libc.so.6 (gdb) bt #0 0x00007ffff76862be in __memset_avx2 () from /lib64/libc.so.6 #1 0x00000000009d0d47 in symbol_table::free_edge (this=0x7ffff733a100, e=<cgraph_edge* 0x7fffc6ad8a28 (<cgraph_node * 0x0> -> <cgraph_node * 0x0>)>) at ../../gcc/cgraph.c:1021 #2 0x00000000009d2dd7 in cgraph_node::remove_callees (this=<cgraph_node * const 0x7fffc6adc5a0 "accept"/1913173>) at ../../gcc/cgraph.c:1668 #3 0x00000000009d340d in cgraph_node::remove (this=<cgraph_node * const 0x7fffc6adc5a0 "accept"/1913173>) at ../../gcc/cgraph.c:1792 #4 0x00000000009ef8be in cgraph_node::remove_symbol_and_inline_clones (this=<cgraph_node * const 0x7fffc6adc5a0 "accept"/1913173>, forbidden_node=<cgraph_node * 0x0>) at ../../gcc/cgraphclones.c:914 #5 0x00000000009d1414 in cgraph_edge::resolve_speculation (this=<cgraph_edge* 0x7fffc6ad8618 (<cgraph_node * 0x0> -> <cgraph_node * 0x0>)>, callee_decl=<tree 0x0>) at ../../gcc/cgraph.c:1208 #6 0x0000000001eb4a86 in check_speculations_1 (n=<cgraph_node * 0x7fffc6adc2d0 "parametersToBuffer"/1913172>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, edge_set=0x7fffffffc8b0) at ../../gcc/ipa-inline-transform.c:260 #7 0x0000000001eb4ab2 in check_speculations_1 (n=<cgraph_node * 0x7fffc6adc168 "_ZN18PrettyPrintVisitor24visitFuncIdentWithPrefixEP12TypeFunctionP10IdentifierP19TemplateDeclaration.part.0"/1913171>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, edge_set=0x7fffffffc8b0) at ../../gcc/ipa-inline-transform.c:265 #8 0x0000000001eb4ab2 in check_speculations_1 (n=<cgraph_node * 0x7fffc6ad1e10 "visitFuncIdentWithPrefix"/1913169>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, edge_set=0x7fffffffc8b0) at ../../gcc/ipa-inline-transform.c:265 #9 0x0000000001eb4ab2 in check_speculations_1 (n=<cgraph_node * 0x7fffc6ac0000 "typeToBuffer"/1913165>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, edge_set=0x7fffffffc8b0) at ../../gcc/ipa-inline-transform.c:265 #10 0x0000000001eb4ab2 in check_speculations_1 (n=<cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, edge_set=0x7fffffffc8b0) at ../../gcc/ipa-inline-transform.c:265 #11 0x0000000001eb4b46 in check_speculations (n=<cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0) at ../../gcc/ipa-inline-transform.c:289 #12 0x0000000001eb56c6 in inline_call (e=<cgraph_edge* 0x7fffc6ab24e0 (<cgraph_node * 0x7fffc6ab1438 "accept"/1913128> -> <cgraph_node * 0x7fffc6ace9d8 "visit"/1913164>)>, update_original=true, Python Exception <class 'gdb.error'> There is no member or method named m_vecpfx.: new_edges=0x7fffffffdad0, overall_size=0x3233d30 <_ZL12overall_size>, update_overall_summary=true, callee_removed=0x0) at ../../gcc/ipa-inline-transform.c:487 #13 0x0000000001ea6a68 in inline_small_functions () at ../../gcc/ipa-inline.c:2085 #14 0x0000000001ea85c0 in ipa_inline () at ../../gcc/ipa-inline.c:2547 #15 0x0000000001ea945f in (anonymous namespace)::pass_ipa_inline::execute (this=0x32978f0) at ../../gcc/ipa-inline.c:2955 #16 0x0000000000f0ddff in execute_one_pass (pass=<opt_pass* 0x32978f0 "inline"(84)>) at ../../gcc/passes.c:2473 #17 0x0000000000f0ed7a in execute_ipa_pass_list (pass=<opt_pass* 0x32978f0 "inline"(84)>) at ../../gcc/passes.c:2913 #18 0x00000000008cbf7a in do_whole_program_analysis () at ../../gcc/lto/lto.c:456 #19 0x00000000008cc2a6 in lto_main () at ../../gcc/lto/lto.c:628 #20 0x0000000001073ff8 in compile_file () at ../../gcc/toplev.c:456 #21 0x0000000001076c7a in do_compile () at ../../gcc/toplev.c:2209 #22 0x0000000001076f5a in toplev::main (this=0x7fffffffdf90, argc=1068, argv=0x3267250) at ../../gcc/toplev.c:2344 #23 0x0000000001fd06b9 in main (argc=30, argv=0x7fffffffe098) at ../../gcc/main.c:39 (gdb) c Continuing. Breakpoint 1, fancy_abort (file=0x2a6413b "../../gcc/ipa-inline.c", line=1632, function=0x2a65250 <add_new_edges_to_heap(fibonacci_heap<sreal, cgraph_edge>*, vec<cgraph_edge*, va_heap, vl_ptr>)::__FUNCTION__> "add_new_edges_to_heap") at ../../gcc/diagnostic.c:1614 1614 internal_error ("in %s, at %s:%d", function, trim_filename (file), line); (gdb) Hope it will help.