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

            Bug ID: 100492
           Summary: wrong code at -O3 (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 seems to be a recent regression.

[619] % 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/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210509 (experimental) [master revision
56103737f17:37fd4fac862:5e0236d3b0e0d7ad98bcee36128433fa755b5558] (GCC) 
[620] % 
[620] % gcctk -O2 small.c; ./a.out
0
[621] % gcc110 -O3 small.c; ./a.out
0
[622] % 
[622] % gcctk -O3 small.c
[623] % timeout -s 9 10 ./a.out
Killed
[624] % 
[624] % cat small.c
int printf (const char *, ...);
char a, c;
int b, d, *e = &d, g;
static char f;
int main() {
  int h = 0;
  for (; a < 1; a++) {
    int *i[5], **j = &i[4], ***k[3][2] = {{&j}}, ****l = &k[2][1], *****m = &l;
    char *n = &c;
    f = *e = g = 0;
    for (; g < 2; g++) {
      for (b = 0; b < 3; b++)
        h = (h && (*n = 0)) == 0;
      if (g)
        break;
    }
  }
  printf("%d\n", f);
  return 0;
}

Reply via email to