https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120341
Bug ID: 120341 Summary: wrong code at -O1 and above with "-fallow-store-data-races" on x86_64-linux-gnu Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhendong.su at inf dot ethz.ch Target Milestone: --- Compiler Explorer: https://godbolt.org/z/PK19PqYjq It appears to be a regression from 14.2, and affects 15.1 and later. [561] % gcctk -v Using built-in specs. COLLECT_GCC=gcctk COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-trunk/configure --disable-bootstrap --enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk --enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix Supported LTO compression algorithms: zlib gcc version 16.0.0 20250518 (experimental) (GCC) [562] % [562] % gcctk -O1 small.c; ./a.out [563] % [563] % gcctk -O1 -fallow-store-data-races small.c [564] % ./a.out Segmentation fault [565] % [565] % cat small.c char a, *b; int main() { b = "0"; if (a) b[0]++; return 0; }