https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100230
Bug ID: 100230 Summary: ASan: alloc-dealloc-mismatch in early-remat.c Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- Bootstrapping on aarch64 --with-build-config=bootstrap-asan and running the testsuite shows the following issue: $ cat test.c int a, b; void c() { while (b) a += b++; } $ gcc/xgcc -B gcc -c test.c -march=armv8.2-a+sve -O2 -ftree-vectorize ================================================================= ==22323==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0xffff92f0d900 #0 0x75ed5c in operator delete(void*, unsigned long) /home/alecop01/toolchain/src/gcc/libsanitizer/asan/asan_new_delete.cpp:172 #1 0x33b033c in sort_candidates /home/alecop01/toolchain/src/gcc/gcc/early-remat.c:1062 #2 0x33b033c in run /home/alecop01/toolchain/src/gcc/gcc/early-remat.c:2567 #3 0x33b033c in execute /home/alecop01/toolchain/src/gcc/gcc/early-remat.c:2629 #4 0x151ebd4 in execute_one_pass(opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2567 #5 0x15201a0 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2656 #6 0x15201c4 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2657 #7 0x1520270 in execute_pass_list(function*, opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2667 #8 0xbb7c34 in cgraph_node::expand() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1830 #9 0xbb7c34 in cgraph_node::expand() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1783 #10 0xbba6d4 in expand_all_functions /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1994 #11 0xbba6d4 in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2358 #12 0xbc18a8 in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2271 #13 0xbc18a8 in symbol_table::finalize_compilation_unit() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2539 #14 0x1793f44 in compile_file /home/alecop01/toolchain/src/gcc/gcc/toplev.c:482 #15 0x6d4ffc in do_compile /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2201 #16 0x6d4ffc in toplev::main(int, char**) /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2340 #17 0x6df804 in main /home/alecop01/toolchain/src/gcc/gcc/main.c:39 #18 0xffff973276dc in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206dc) #19 0x6e271c (/data/alecop01/builds/gcc11-bstrap-asan/gcc/cc1+0x6e271c) 0xffff92f0d900 is located 0 bytes inside of 28-byte region [0xffff92f0d900,0xffff92f0d91c) allocated by thread T0 here: #0 0x75e16c in operator new[](unsigned long) /home/alecop01/toolchain/src/gcc/libsanitizer/asan/asan_new_delete.cpp:102 #1 0x33b027c in sort_candidates /home/alecop01/toolchain/src/gcc/gcc/early-remat.c:1056 #2 0x33b027c in run /home/alecop01/toolchain/src/gcc/gcc/early-remat.c:2567 #3 0x33b027c in execute /home/alecop01/toolchain/src/gcc/gcc/early-remat.c:2629 #4 0x151ebd4 in execute_one_pass(opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2567 #5 0x15201a0 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2656 #6 0x15201c4 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2657 #7 0x1520270 in execute_pass_list(function*, opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2667 #8 0xbb7c34 in cgraph_node::expand() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1830 #9 0xbb7c34 in cgraph_node::expand() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1783 #10 0xbba6d4 in expand_all_functions /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1994 #11 0xbba6d4 in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2358 #12 0xbc18a8 in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2271 #13 0xbc18a8 in symbol_table::finalize_compilation_unit() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2539 #14 0x1793f44 in compile_file /home/alecop01/toolchain/src/gcc/gcc/toplev.c:482 #15 0x6d4ffc in do_compile /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2201 #16 0x6d4ffc in toplev::main(int, char**) /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2340 #17 0x6df804 in main /home/alecop01/toolchain/src/gcc/gcc/main.c:39 #18 0xffff973276dc in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206dc) #19 0x6e271c (/data/alecop01/builds/gcc11-bstrap-asan/gcc/cc1+0x6e271c) The fix looks obvious.