https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100211
Bug ID: 100211 Summary: aarch64: OOB accesses in aarch64_{save,restore}_callee_saves Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: acoplan at gcc dot gnu.org Target Milestone: --- Bootstrapping on aarch64 --with-build-config=bootstrap-ubsan shows OOB accesses in aarch64_{save,restore}_callee_saves with the following SVE testcase (reduced from gcc.target/aarch64/sve/acle/general/cpy_1.c). $ cat sve_test.c #include <arm_sve.h> svuint64_t a() { register svbool_t b asm("p15"); asm("" : "=Upa"(b)); } $ gcc/xgcc -B gcc sve_test.c -c -march=armv8.2-a+sve /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.c:7754:57: runtime error: index 83 out of bounds for type 'bool [83]' #0 0x2de50e4 in aarch64_save_callee_saves /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.c:7754 #1 0x2e25d48 in aarch64_expand_prologue() /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.c:8776 #2 0x3bdfad4 in gen_prologue() /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.md:852 #3 0x2da1610 in target_gen_prologue /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.md:7444 #4 0x11d210c in make_prologue_seq /home/alecop01/toolchain/src/gcc/gcc/function.c:5801 #5 0x11d27bc in thread_prologue_and_epilogue_insns() /home/alecop01/toolchain/src/gcc/gcc/function.c:6019 #6 0x11d4a24 in rest_of_handle_thread_prologue_and_epilogue /home/alecop01/toolchain/src/gcc/gcc/function.c:6510 #7 0x11d4a24 in execute /home/alecop01/toolchain/src/gcc/gcc/function.c:6586 #8 0x1b5ec1c in execute_one_pass(opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2567 #9 0x1b623b8 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2656 #10 0x1b623f0 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2657 #11 0x1b623f0 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2657 #12 0x1b624d4 in execute_pass_list(function*, opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2667 #13 0xc7b2a4 in cgraph_node::expand() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1830 #14 0xc7fa90 in output_in_order /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2137 #15 0xc7fa90 in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2355 #16 0xc8b81c in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2271 #17 0xc8b81c in symbol_table::finalize_compilation_unit() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2539 #18 0x1f97478 in compile_file /home/alecop01/toolchain/src/gcc/gcc/toplev.c:482 #19 0x68d9b0 in do_compile /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2201 #20 0x68d9b0 in toplev::main(int, char**) /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2340 #21 0x6910d0 in main /home/alecop01/toolchain/src/gcc/gcc/main.c:39 #22 0xffff881b66dc in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206dc) #23 0x691b2c (/data/alecop01/builds/bstrap-ubsan/gcc/cc1+0x691b2c) /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.c:7855:57: runtime error: index 83 out of bounds for type 'bool [83]' #0 0x2de26e8 in aarch64_restore_callee_saves /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.c:7855 #1 0x2de363c in aarch64_expand_epilogue(bool) /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.c:8888 #2 0x3bdfb4c in gen_epilogue() /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.md:861 #3 0x2da14bc in target_gen_epilogue /home/alecop01/toolchain/src/gcc/gcc/config/aarch64/aarch64.md:7193 #4 0x11d2338 in make_epilogue_seq /home/alecop01/toolchain/src/gcc/gcc/function.c:5938 #5 0x11d27c4 in thread_prologue_and_epilogue_insns() /home/alecop01/toolchain/src/gcc/gcc/function.c:6020 #6 0x11d4a24 in rest_of_handle_thread_prologue_and_epilogue /home/alecop01/toolchain/src/gcc/gcc/function.c:6510 #7 0x11d4a24 in execute /home/alecop01/toolchain/src/gcc/gcc/function.c:6586 #8 0x1b5ec1c in execute_one_pass(opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2567 #9 0x1b623b8 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2656 #10 0x1b623f0 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2657 #11 0x1b623f0 in execute_pass_list_1 /home/alecop01/toolchain/src/gcc/gcc/passes.c:2657 #12 0x1b624d4 in execute_pass_list(function*, opt_pass*) /home/alecop01/toolchain/src/gcc/gcc/passes.c:2667 #13 0xc7b2a4 in cgraph_node::expand() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:1830 #14 0xc7fa90 in output_in_order /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2137 #15 0xc7fa90 in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2355 #16 0xc8b81c in symbol_table::compile() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2271 #17 0xc8b81c in symbol_table::finalize_compilation_unit() /home/alecop01/toolchain/src/gcc/gcc/cgraphunit.c:2539 #18 0x1f97478 in compile_file /home/alecop01/toolchain/src/gcc/gcc/toplev.c:482 #19 0x68d9b0 in do_compile /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2201 #20 0x68d9b0 in toplev::main(int, char**) /home/alecop01/toolchain/src/gcc/gcc/toplev.c:2340 #21 0x6910d0 in main /home/alecop01/toolchain/src/gcc/gcc/main.c:39 #22 0xffff881b66dc in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x206dc) #23 0x691b2c (/data/alecop01/builds/bstrap-ubsan/gcc/cc1+0x691b2c)