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

--- Comment #4 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
If it's helpful, one more test that fails (only) at -Os:
* Compiler Explorer: https://godbolt.org/z/6MfG5seKE
* works: 14.* and earlier
* fails: 15.1 and trunk
* -fwrapv or -fno-ivopts makes it disappear

[517] % 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 20250609 (experimental) (GCC) 
[518] % 
[518] % gcctk -Os small.c
[519] % ./a.out
Aborted
[520] % cat small.c
int a, b, c;
static void d(int e) {
  while (1) {
    b = -1000 * b - 1;
    if (b > 0)
      break;
    a = -1000 * c;
    c = e + c - 2148000;
    if (a < 0)
      __builtin_abort();
  }
}
void f() { d(1); }
int main() { d(0); }

Reply via email to