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

            Bug ID: 120630
           Summary: wrong code at -O{s,2,3} with "-fno-tree-loop-im
                    -fno-tree-loop-optimize -fno-tree-ch" 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: ---

This appears to be a very recent regression as the latest build from Compiler
Explorer doesn't fail. 

[541] % 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 20250611 (experimental) (GCC) 
[542] % 
[542] % gcctk -O3 small.c; ./a.out
[543] % 
[543] % gcctk -O3 -fno-tree-loop-im -fno-tree-loop-optimize -fno-tree-ch
small.c
[544] % ./a.out
Aborted
[545] % cat small.c
int a, c, d;
void e(int b) { a = b; }
int main() {
  while (d)
    ;
  for (c = 0; c > -3; c--) {
    long f = c;
    e(f >> 2);
  }
  if (a != -1)
    __builtin_abort();
  return 0;
}

Reply via email to