https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120043

            Bug ID: 120043
           Summary: wrong code at -O{s,2,3} 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/3znP9eqWz

It appears to be a recent regression, and affects 15.1 and later.

[518] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/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 20250430 (experimental) (GCC) 
[519] % 
[519] % gcctk -O3 small.c; ./a.out
[520] % 
[520] % gcctk -O3 -fallow-store-data-races small.c
[521] % ./a.out
Segmentation fault
[522] % 
[522] % cat small.c
const int a;
int *b;
int main() {
  &a != b || (*b = 1);
  return 0;
}

Reply via email to