https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114956
Bug ID: 114956 Summary: Segmentation fault with -fsanitize=address -fsanitize=null -O2 when attribute no_sanitize_address is enabled Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: iamanonymous.cs at gmail dot com CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org Target Milestone: --- Compiler Explorer: https://godbolt.org/z/33rbWdf49 ******************************************************************************* gcc version: $ gcc -v Using built-in specs. COLLECT_GCC=/home/gcc_set/gcc-trunk/bin/gcc COLLECT_LTO_WRAPPER=/home/gcc_set/gcc-trunk/libexec/gcc/aarch64-unknown-linux-gnu/15.0.0/lto-wrapper Target: aarch64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/home/gcc_set/gcc-trunk --with-gmp=/home/build_essential --with-mpfr=/home/build_essential --with-mpc=/home/build_essential --enable-languages=c,c++ --disable-multilib --with-sanitizer=address,undefined,thread,leakcd CC=gcc CXX=g++ Thread model: posix Supported LTO compression algorithms: zlib gcc version 15.0.0 20240430 (experimental) (GCC) git version: 22b20ac6c6aead2d3f36c413a77dd0b80adfec39 ******************************************************************************* Program: $ cat mutant.c int **a; __attribute__((always_inline)) int *c() { int b[1]; b; } __attribute__((no_sanitize_address)) static char d() { *a = c(); } void e() { d(); } ******************************************************************************* Command Lines: $ gcc -fsanitize=address -fsanitize=null -O2 -c mutant.c mutant.c:2:37: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes] 2 | __attribute__((always_inline)) int *c() { | ^ during GIMPLE pass: sanopt mutant.c: In function 'd.isra': mutant.c:6:50: internal compiler error: Segmentation fault 6 | __attribute__((no_sanitize_address)) static char d() { *a = c(); } | ^ 0xf2d49b crash_signal ../../gcc/gcc/toplev.cc:319 0xf3fcfc contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../gcc/gcc/tree.h:3769 0xf3fcfc build_shadow_mem_access ../../gcc/gcc/asan.cc:2552 0xf4b90f asan_expand_mark_ifn(gimple_stmt_iterator*) ../../gcc/gcc/asan.cc:3854 0xf5f6bf execute ../../gcc/gcc/sanopt.cc:1379 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions