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

            Bug ID: 115933
           Summary: wrong code at -O1 with "-fno-tree-loop-optimize
                    -ftree-vrp -fno-tree-ch -fgcse" 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: ---

It appears to be a recent regression as it doesn't reproduce with 14.1 and
earlier.

Compiler Explorer: https://godbolt.org/z/5PoGKzzcx

[550] % 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/15.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 15.0.0 20240715 (experimental) (GCC) 
[551] % 
[551] % gcctk -O1 -fno-tree-loop-optimize -ftree-vrp -fno-tree-ch -fgcse
small.c
[552] % ./a.out
Aborted
[553] % 
[553] % cat small.c
int a, b;
unsigned c() {
  int d, e = d = 2;
  if (a < 0)
    for (e = 0; e < 1; e++)
      d = 0;
  b = e;
  return d;
}
int main() {
  c();
  if (b != 2)
    __builtin_abort();
  return 0;
}
  • [Bug tree-optimization/115933]... zhendong.su at inf dot ethz.ch via Gcc-bugs

Reply via email to