hygoni / precise-leak-sanitizer

A dynamic memory leak detector that can pinpoint where memory is lost, using LLVM pass
Apache License 2.0
17 stars 2 forks source link

Bug: gcc crash in checkPreciseLeak() #116

Open hygoni opened 1 month ago

hygoni commented 1 month ago
=================================================================
==245900==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 3750528 byte(s) in 58602 object(s) allocated from:
    #0 0x55ab82b14cda in malloc /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/plsan/plsan_allocation_functions.cpp:137:3
    #1 0x55ab83cca053 in xrealloc /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/xmalloc.c:177:14
    #2 0x55ab83cc655c in vec_heap_o_reserve_1 /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/vec.c:320:9
    #3 0x55ab83cc6420 in vec_heap_p_reserve /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/vec.c:338:10
    #4 0x55ab839063f7 in VEC_data_reference_p_heap_reserve /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/./tree-data-ref.h:209:1
    #5 0x55ab838eee07 in VEC_data_reference_p_heap_safe_push /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/./tree-data-ref.h:209:1
    #6 0x55ab838eea00 in find_data_references_in_stmt /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-data-ref.c:4187:7
    #7 0x55ab838ef4b1 in find_data_references_in_bb /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-data-ref.c:4238:12
    #8 0x55ab838efeef in compute_data_dependences_for_bb /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-data-ref.c:4424:7
    #9 0x55ab83bb4cfa in vect_analyze_data_refs /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-vect-data-refs.c:1888:13
    #10 0x55ab83c0b6e4 in vect_slp_analyze_bb /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-vect-slp.c:1299:8
    #11 0x55ab83c19434 in execute_vect_slp /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-vectorizer.c:276:11
    #12 0x55ab836d67db in execute_one_pass /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/passes.c:1568:20
    #13 0x55ab836d70d5 in execute_pass_list /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/passes.c:1623:11
    #14 0x55ab836d70fd in execute_pass_list /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/passes.c:1624:9
    #15 0x55ab836d70fd in execute_pass_list /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/passes.c:1624:9
    #16 0x55ab8399c8c6 in tree_rest_of_compilation /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/tree-optimize.c:413:3
    #17 0x55ab82cf41ad in cgraph_expand_function /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/cgraphunit.c:1562:3
    #18 0x55ab82cf841f in cgraph_expand_all_functions /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/cgraphunit.c:1641:4
    #19 0x55ab82cf6dff in cgraph_optimize /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/cgraphunit.c:1889:7
    #20 0x55ab82cf5ee1 in cgraph_finalize_compilation_unit /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/cgraphunit.c:1110:3
    #21 0x55ab82b9b647 in c_write_global_declarations /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/c-decl.c:9523:3
    #22 0x55ab83cdf97e in compile_file /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/toplev.c:1070:3
    #23 0x55ab83cde5b9 in do_compile /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/toplev.c:2428:2
    #24 0x55ab83cde1d8 in toplev_main /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/toplev.c:2470:5
    #25 0x55ab82b4729c in main /usr/cpu2017.3/benchspec/CPU/502.gcc_r/build/build_base_mytest-m64.0000/main.c:35:10
    #26 0x7fe6365d7b89 in __libc_start_call_main (/lib64/libc.so.6+0x27b89) (BuildId: 9148cab1b932d44ef70e306e9c02ee38d06cad51)
    #27 0x7fe6365d7c4a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c4a) (BuildId: 9148cab1b932d44ef70e306e9c02ee38d06cad51)
    #28 0x55ab82b0bba4 in _start (/usr/cpu2017.3/benchspec/CPU/502.gcc_r/run/run_base_refrate_mytest-m64.0006/cpugcc_r_base.mytest-m64+0x12bba4)
PreciseLeakSanitizer:DEADLYSIGNAL
==245900==ERROR: PreciseLeakSanitizer: SEGV on unknown address 0x7f65c9e6b000 (pc 0x55ab82b41165 bp 0x000000000000 sp 0x7ffd45c0d660 T0)
==245900==The signal is caused by a READ memory access.
    #0 0x55ab82b41165 in __lsan::checkPreciseLeak(unsigned int) /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:983:32
    #1 0x55ab82b41165 in __lsan::LeakReport::PrintReportForPreciseLeak(unsigned long) /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:941:28
    #2 0x55ab82b41453 in __lsan::LeakReport::ReportTopLeaks(unsigned long) /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:909:32
    #3 0x55ab82b41453 in __lsan::LeakReport::ReportTopLeaks(unsigned long) /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:890:6
    #4 0x55ab82b44826 in __lsan::PrintResults(__lsan::LeakReport&) /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:751:26
    #5 0x55ab82b44b3b in __lsan::CheckForLeaks() /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:796:26
    #6 0x55ab82b44bf3 in __lsan::DoLeakCheck() /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:823:37
    #7 0x7fe6365f01e5 in __run_exit_handlers (/lib64/libc.so.6+0x401e5) (BuildId: 9148cab1b932d44ef70e306e9c02ee38d06cad51)
    #8 0x7fe6365f032d in exit (/lib64/libc.so.6+0x4032d) (BuildId: 9148cab1b932d44ef70e306e9c02ee38d06cad51)
    #9 0x7fe6365d7b90 in __libc_start_call_main (/lib64/libc.so.6+0x27b90) (BuildId: 9148cab1b932d44ef70e306e9c02ee38d06cad51)
    #10 0x7fe6365d7c4a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c4a) (BuildId: 9148cab1b932d44ef70e306e9c02ee38d06cad51)
    #11 0x55ab82b0bba4 in _start (/usr/cpu2017.3/benchspec/CPU/502.gcc_r/run/run_base_refrate_mytest-m64.0006/cpugcc_r_base.mytest-m64+0x12bba4)
PreciseLeakSanitizer can not provide additional info.
SUMMARY: PreciseLeakSanitizer: SEGV /home/hyeyoo/precise-leak-sanitizer/compiler-rt/lib/lsan/lsan_common.cpp:983:32 in __lsan::checkPreciseLeak(unsigned int)
hygoni commented 1 month ago

@kimseongyu