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

            Bug ID: 126270
           Summary: wrong code at -O{2,3} on x86_64-linux-gnu
                    (nondeterministic hang)
           Product: gcc
           Version: 16.0
            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: ---

[768] % 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/17.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++,lto --disable-werror
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 17.0.0 20260715 (experimental) (GCC)
[769] %
[769] % gcctk -O2 small.c
[770] % for i in $(seq 1 10); do
> echo $i
> timeout -s 9 2 ./a.out
> done
1
Killed
2
Killed
3
4
5
Killed
6
7
Killed
8
9
10
[771] % cat small.c
int a, b, c, d, e = 1, f, g, h, i, j, k;
int main() {
  char l;
  if (c) {
  m:
    if (g)
      goto n;
    return b;
  }
n:
  g = 1;
  i = h = a || d;
  l = ~(a - ~(e && f) && d);
  j = l + d - h;
  k = d && i && f;
  if (j < 1)
    g = k;
  goto m;
  return 0;
}

Reply via email to