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

--- Comment #4 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Here is another very similar reproducer that only fails at -Os and seems to go
back to at least as early as 10.1. 

Compiler Explorer: https://godbolt.org/z/7e4jePnY7


[508] % 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 20250521 (experimental) (GCC) 
[509] % 
[509] % gcctk -Os small.c; ./a.out
[510] % 
[510] % gcctk -Os -fallow-store-data-races small.c
[511] % ./a.out
Segmentation fault
[512] % 
[512] % cat small.c
char a, *b;
int main() {
  while (a) {
    b = "0";
    b[0]++;
  }
  return 0;
}

Reply via email to