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

            Bug ID: 108139
           Summary: wrong code with "-O1 -ftree-vrp" 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.

Compiler Explorer: https://godbolt.org/z/ocGqn8jTY


[554] % 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/13.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
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221216 (experimental) [master r13-4736-gfb33e104f48] (GCC) 
[555] % 
[555] % gcctk -O1 small.c; ./a.out
[555] % 
[556] % gcctk -O1 -ftree-vrp small.c
[557] % timeout -s 9 5 ./a.out
Killed
[558] % 
[558] % cat small.c
int a, b;
int main() {
  int c;
  if (a > 1)
    a++;
  while (a)
    if (c == b)
      c = a;
  return 0;
}

Reply via email to