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

--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Here is another test that fails at -O{s,2,3} and doesn't require the flag
-fno-tree-loop-im.

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


[669] % gcctk -O3 small.c
during GIMPLE pass: pre
small.c: In function ‘main’:
small.c:3:5: internal compiler error: in compute_antic, at tree-ssa-pre.cc:2449
    3 | int main() {
      |     ^~~~
0x25727ab internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:786
0xa0a1ce fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1803
0x8ec794 compute_antic
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:2449
0x8ec794 execute
        ../../gcc-trunk/gcc/tree-ssa-pre.cc:4476
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[670] %
[670] % cat small.c
int a, b, *c = &a, d, e, f;
void g(int *p) { a = p[0]; }
int main() {
  int h = 0;
i:
  d = c[0];
  c[0] = h;
  if (a)
    goto j;
k:
  h = c[0] - 1;
  while (1) {
    if (b)
      goto i;
    if (f)
      goto k;
  j:
    if (!e) {
      int m[] = {c[0]};
      g(m);
      break;
    }
  }
  return 0;
}

Reply via email to