Message ID | 20241029123539.2082268-1-dmalcolm@redhat.com |
---|---|
State | New |
Headers | show |
Series | [pushed:,r15-4739] jit: fix leak of pending_assemble_externals_set [PR117275] | expand |
diff --git a/gcc/varasm.cc b/gcc/varasm.cc index ce1077b6d4bd..deefbac5b7b2 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -2575,6 +2575,7 @@ process_pending_assemble_externals (void) pending_assemble_externals_processed = true; pending_libcall_symbols = NULL_RTX; delete pending_assemble_externals_set; + pending_assemble_externals_set = nullptr; #endif } @@ -8893,6 +8894,7 @@ varasm_cc_finalize () #ifdef ASM_OUTPUT_EXTERNAL pending_assemble_externals_processed = false; + delete pending_assemble_externals_set; pending_assemble_externals_set = nullptr; #endif
My recent r15-4580-g779c0390e3b57d fix for resetting state in varasm.cc introduced some noise to "make selftest-valgrind" and, presumably, a memory leak in libgccjit: ==2462086== 160 (56 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 248 of 352 ==2462086== at 0x5270E7D: operator new(unsigned long) (vg_replace_malloc.c:342) ==2462086== by 0x1D1EB89: init_varasm_once() (varasm.cc:6806) ==2462086== by 0x181C845: backend_init() (toplev.cc:1826) ==2462086== by 0x181D41A: do_compile() (toplev.cc:2193) ==2462086== by 0x181D99C: toplev::main(int, char**) (toplev.cc:2371) ==2462086== by 0x378391D: main (main.cc:39) Fixed thusly. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Tested lightly on powerpc64le-unknown-linux-gnu. Pushed to trunk as r15-4739-g7f41203f08b994. gcc/ChangeLog: PR jit/117275 * varasm.cc (process_pending_assemble_externals): Reset pending_assemble_externals_set to nullptr after deleting it. (varasm_cc_finalize): Delete pending_assemble_externals_set. Signed-off-by: David Malcolm <dmalcolm@redhat.com> --- gcc/varasm.cc | 2 ++ 1 file changed, 2 insertions(+)