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

            Bug ID: 115494
           Summary: wrong code at -O{2,3} with "-fno-ssa-phiopt" on
                    x86_64-linux-gnu (the generated code hangs)
           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 13.* and
earlier. 

Compiler Explorer: https://godbolt.org/z/889EdEeE9

[627] % 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 20240614 (experimental) (GCC) 
[628] % 
[628] % gcctk -O2 small.c; ./a.out; echo $?
0
[629] % gcctk -O2 -fno-ssa-phiopt small.c; ./a.out; echo $?
1
[630] % cat small.c
unsigned char a;
int b = 1, c, d;
int main() {
  char e;
  c = b - c;
  a = ~(c || a);
  e = -(b ^ a);
  d = e && b;
  a = ~(b & a);
  if (a < 2)
    return 1;
  return 0;
}

Reply via email to