http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54343
Bug #: 54343 Summary: RTL postreload leaks DF memory Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org With valgrind on the testcase from PR54146 you can see leaks of the kind ==28803== 3,984 bytes in 249 blocks are definitely lost in loss record 28,125 of 29,883 ==28803== at 0x4C29ADD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==28803== by 0xCE28D7: xmalloc (xmalloc.c:147) ==28803== by 0x6B064D: df_refs_add_to_chains(df_collection_rec*, basic_block_def*, rtx_def*) (df-scan.c:2669) ==28803== by 0x6B5144: df_bb_refs_record(int, bool) (df-scan.c:3644) ==28803== by 0x6B524C: df_scan_blocks() (df-scan.c:678) ==28803== by 0x7B6B7D: rest_of_handle_reload() (ira.c:4390) ==28803== by 0x818C4A: execute_one_pass(opt_pass*) (passes.c:2157) ==28803== by 0x818F94: execute_pass_list(opt_pass*) (passes.c:2212) ==28803== by 0x818FA6: execute_pass_list(opt_pass*) (passes.c:2213) ==28803== by 0x68F583: expand_function(cgraph_node*) (cgraphunit.c:1609) ==28803== by 0x6909E8: compile() (cgraphunit.c:1714) ==28803== by 0x690F64: finalize_compilation_unit() (cgraphunit.c:2089) do_reload re-adds the live problem and calls run_fast_dce. Either that or subsequent passes that end up removing instructions do not bother with freeing associated DF info. At least I don't see that delete_insn calls df_insn_delete or so. Thus keeping DF initialized throughout postreload may be not the best idea ...