This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix two leaks in postreload-gcse.c


On 05/14/2015 10:38 AM, David Malcolm wrote:
Running jit.dg/test-sum-of-squares.c under valgrind showed a couple of leaks:

608 bytes in 4 blocks are definitely lost in loss record 184 of 229
    at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x5BC88B0: xcalloc (xmalloc.c:162)
    by 0x524F72D: alloc_mem() (postreload-gcse.c:352)
    by 0x5252611: gcse_after_reload_main(rtx_def*) (postreload-gcse.c:1390)
    by 0x5252828: rest_of_handle_gcse2() (postreload-gcse.c:1444)
    by 0x52528DA: (anonymous namespace)::pass_gcse2::execute(function*) (postreload-gcse.c:1478)
    by 0x5249D2A: execute_one_pass(opt_pass*) (passes.c:2317)
    by 0x5249FB1: execute_pass_list_1(opt_pass*) (passes.c:2370)
    by 0x5249FE2: execute_pass_list_1(opt_pass*) (passes.c:2371)
    by 0x5249FE2: execute_pass_list_1(opt_pass*) (passes.c:2371)
    by 0x524A01F: execute_pass_list(function*, opt_pass*) (passes.c:2381)
    by 0x4EC075C: cgraph_node::expand() (cgraphunit.c:1895)

608 bytes in 4 blocks are definitely lost in loss record 185 of 229
    at 0x4A081D4: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x5BC88B0: xcalloc (xmalloc.c:162)
    by 0x524F754: alloc_mem() (postreload-gcse.c:355)
    by 0x5252611: gcse_after_reload_main(rtx_def*) (postreload-gcse.c:1390)
    by 0x5252828: rest_of_handle_gcse2() (postreload-gcse.c:1444)
    by 0x52528DA: (anonymous namespace)::pass_gcse2::execute(function*) (postreload-gcse.c:1478)
    by 0x5249D2A: execute_one_pass(opt_pass*) (passes.c:2317)
    by 0x5249FB1: execute_pass_list_1(opt_pass*) (passes.c:2370)
    by 0x5249FE2: execute_pass_list_1(opt_pass*) (passes.c:2371)
    by 0x5249FE2: execute_pass_list_1(opt_pass*) (passes.c:2371)
    by 0x524A01F: execute_pass_list(function*, opt_pass*) (passes.c:2381)
    by 0x4EC075C: cgraph_node::expand() (cgraphunit.c:1895)

The following patch fixes them (verified via rerunning under valgrind).

OK for trunk? (assuming I bootstrap and test it)

gcc/ChangeLog:
	* postreload-gcse.c (free_mem): Free modify_mem_list and
	canon_modify_mem_list.
OK.  Not sure how I missed them when I added that code.

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]