https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91062
Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #2 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> --- varmap is allocated on the heap, and lives across passes. Yes it references a name that is sometimes in static storage, but mostly in ggc-allocated memory. I suppose inhibiting garbage collection during ipa would be no good, so either the names should be allocated on the heap (ironically, often the name is generated on the heap and later copied to ggc memory), or be reachable from a ggc root. I have traced the output of one garbage string emitted in the dump file for gcc.dg/torture/ipa-pta-1.c back to its origin (index is 9 in new_var_info, and the string is in "name"; gcc source svn revision is 272931): #0 new_var_info (t=0x0, name=0x7fffefba2050 "test4.clobber", add_id=false) at ../../gcc/gcc/tree-ssa-structalias.c:383 #1 0x0000000000fa2d81 in create_function_info_for (decl=0x7fffefce8700, name=0x7fffefb9ff40 "test4", add_id=false, nonlocal_p=true) at ../../gcc/gcc/tree-ssa-structalias.c:5785 #2 0x0000000000fa9725 in ipa_pta_execute () at ../../gcc/gcc/tree-ssa-structalias.c:8095 #3 0x0000000000faab71 in (anonymous namespace)::pass_ipa_pta::execute ( this=0x271a9e0) at ../../gcc/gcc/tree-ssa-structalias.c:8493 #4 0x0000000000c5e991 in execute_one_pass (pass=pass@entry=0x271a9e0) at ../../gcc/gcc/passes.c:2473 #5 0x0000000000c5fa32 in execute_ipa_pass_list (pass=0x271a9e0) at ../../gcc/gcc/passes.c:2913 #6 0x00000000008918e9 in symbol_table::compile ( this=this@entry=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2648 #7 0x0000000000894b08 in symbol_table::compile (this=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2825 #8 symbol_table::finalize_compilation_unit (this=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2861 #9 0x0000000000d8d544 in compile_file () at ../../gcc/gcc/toplev.c:481 #10 0x00000000006b8919 in do_compile () at ../../gcc/gcc/toplev.c:2209 #11 toplev::main (this=this@entry=0x7fffffffddf0, argc=<optimized out>, argc@entry=22, argv=<optimized out>, argv@entry=0x7fffffffdef8) ... at the end of the pass ... #0 ggc_collect () at ../../gcc/gcc/ggc-page.c:2174 #1 0x0000000000c5e6fb in execute_one_ipa_transform_pass (ipa_pass=0x271a2e0, node=0x7fffefb9d708) at ../../gcc/gcc/passes.c:2232 #2 execute_all_ipa_transforms () at ../../gcc/gcc/passes.c:2250 #3 0x0000000000882662 in cgraph_node::get_body (this=0x7fffefb9d708) at ../../gcc/gcc/cgraph.c:3621 #4 0x0000000000fa9633 in ipa_pta_execute () at ../../gcc/gcc/tree-ssa-structalias.c:8077 #5 0x0000000000faab71 in (anonymous namespace)::pass_ipa_pta::execute ( this=0x271a9e0) at ../../gcc/gcc/tree-ssa-structalias.c:8493 #6 0x0000000000c5e991 in execute_one_pass (pass=pass@entry=0x271a9e0) at ../../gcc/gcc/passes.c:2473 #7 0x0000000000c5fa32 in execute_ipa_pass_list (pass=0x271a9e0) at ../../gcc/gcc/passes.c:2913 #8 0x00000000008918e9 in symbol_table::compile ( this=this@entry=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2648 #9 0x0000000000894b08 in symbol_table::compile (this=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2825 #10 symbol_table::finalize_compilation_unit (this=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2861 #11 0x0000000000d8d544 in compile_file () at ../../gcc/gcc/toplev.c:481 #12 0x00000000006b8919 in do_compile () at ../../gcc/gcc/toplev.c:2209 #13 toplev::main (this=this@entry=0x7fffffffddf0, argc=<optimized out>, ... lots of garbage collections and constraint dumpings later... #0 __GI__IO_fputs (str=0x7fffefba2050 '\245' <repeats 64 times>, "\"", fp=0x27fd8e0) at iofputs.c:32Breakpoint 8, dump_constraint (file=0x27fd8e0, c=0x281fc38) at ../../gcc/gcc/tree-ssa-structalias.c:678 678 fprintf (file, "%s", get_varinfo (c->lhs.var)->name); (gdb) s get_varinfo (n=9) at ../../gcc/gcc/tree-ssa-structalias.c:346 346 return varmap[n]; (gdb) fin Run till exit from #0 get_varinfo (n=9) at ../../gcc/gcc/tree-ssa-structalias.c:346 0x0000000000f9570e in dump_constraint (file=0x27fd8e0, c=0x281fc38) at ../../gcc/gcc/tree-ssa-structalias.c:678 678 fprintf (file, "%s", get_varinfo (c->lhs.var)->name); Value returned is $27 = (variable_info *) 0x27cd7b0 (gdb) s __GI__IO_fputs (str=0x7fffefba2050 '\245' <repeats 64 times>, "\"", fp=0x27fd8e0) at iofputs.c:32 32 { (gdb) p $22 $28 = 0x7fffefba2050 '\245' <repeats 64 times>, "\"" (gdb) bt #0 __GI__IO_fputs (str=0x7fffefba2050 '\245' <repeats 64 times>, "\"", fp=0x27fd8e0) at iofputs.c:32 #1 0x0000000000f95721 in dump_constraint (file=0x27fd8e0, c=0x281fc38) at ../../gcc/gcc/tree-ssa-structalias.c:678 #2 0x0000000000f958db in dump_constraints (file=0x27fd8e0, from=44) at ../../gcc/gcc/tree-ssa-structalias.c:723 #3 0x0000000000fa9d22 in ipa_pta_execute () at ../../gcc/gcc/tree-ssa-structalias.c:8193 #4 0x0000000000faab71 in (anonymous namespace)::pass_ipa_pta::execute ( this=0x271a9e0) at ../../gcc/gcc/tree-ssa-structalias.c:8493 #5 0x0000000000c5e991 in execute_one_pass (pass=pass@entry=0x271a9e0) at ../../gcc/gcc/passes.c:2473 #6 0x0000000000c5fa32 in execute_ipa_pass_list (pass=0x271a9e0) at ../../gcc/gcc/passes.c:2913 #7 0x00000000008918e9 in symbol_table::compile ( this=this@entry=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2648 #8 0x0000000000894b08 in symbol_table::compile (this=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2825 #9 symbol_table::finalize_compilation_unit (this=0x7fffefb9e100) at ../../gcc/gcc/cgraphunit.c:2861 #10 0x0000000000d8d544 in compile_file () at ../../gcc/gcc/toplev.c:481 #11 0x00000000006b8919 in do_compile () at ../../gcc/gcc/toplev.c:2209 #12 toplev::main (this=this@entry=0x7fffffffddf0, argc=<optimized out>,