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

            Bug ID: 80193
           Summary: ICE on valid (but hairy) C code at -O3 on
                    x86_64-linux-gnu: in check_allocation, at ira.c:2563
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

This seems to be a recent regression and has been difficult to reduce further.
The code is complex, but valid nonetheless. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.1 20170325 (experimental) [trunk revision 246473] (GCC)
$
$ gcc-trunk -O2 small.c
$
$ gcc-trunk -O3 small.c
bad allocation for 386 and 522
small.c: In function ‘bf’:
small.c:187:1: internal compiler error: in check_allocation, at ira.c:2563
 }
 ^
0xa4f86c check_allocation
        ../../gcc-source-trunk/gcc/ira.c:2563
0xa4f86c ira
        ../../gcc-source-trunk/gcc/ira.c:5374
0xa4f86c execute
        ../../gcc-source-trunk/gcc/ira.c:5592
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$


---------------------------------------------------


int printf (const char *, ...);

char a, e, h, ag, ak, am, ar, ay, az, bc, bd, k, l;
int f, i, n, o, c, ac, ad, p, ah, s, aj, al, an, b, ao, aq, at, av, be, t, u,
g, q, r, ai, **aa, ap;

int d (int v)
{ 
  return v + a;
}

int j (char v, char w)
{ 
  return v - w;
}

void m (int p)
{
}

static void bf ()
{ 
  int bg[240], bi, bk, bl, bj, bm = -1;
  const int *bh;
  if (h)
    { 
      int bn, bo;
      while (1)
        { 
          int *bp = &at;
          const int **bq = &bh, **br = bq;
          while (av)
            while (ah)
              ;
          int bs = r, bt;
          if (bt)
            break;
        bu:
          for (; r; r = d (r))
            { 
              *bp = j (q && b, 0);
              if (n)
                u = b;
              if (u && ak)
                p = 0;
            }
          if (c)
            { 
              while (a)
                while (r)
                  { 
                    int bw = ar, bx = an;
                  by:
                    printf ("%d\n", an);
                    while (ao)
                      while (bw)
                        { 
                          a = !g || f / g;
                          if (i)
                            az = i;
                          l = j (q && bh, 5);
                          if (n != 0)
                            t = l / n;
                          if (t)
                            while (bo)
                              ;
                        }
                    while (a)
                      ;
                    if (s)
                      while (bx)
                        while (1)
                          { 
                            if (r)
                              break;
                            *aa || q;
                          }
                    while (at)
                      ;
                  }
              while (av)
                if (b)
                  goto by;
              while (bl)
                while (1)
                  { 
                    if (r)
                      break;
                    while (ag)
                      if (bi)
                        printf ("%d\n", 0);
                    if (bk)
                      { 
                        bo = bn = bi = printf ("");
                        goto bz;
                      }
                    while (o)
                      if (a)
                        { 
                          while (1)
                            ;
                        ca:
                          ;
                        }
                    if (ap)
                      while (1)
                        ;
                    while (a)
                      { 
                        if (ai)
                          {
                          bz:
                            while (be)
                              if (a)
                                while (bn)
                                  bl = bg[am];
                            while (ac)
                              if (ad)
                                { 
                                  bj++;
                                  while (bj)
                                    if (c)
                                      goto bu;
                                }
                            if (s)
                              { 
                                while (ao)
                                  while (f)
                                    while (p)
                                      if (e)
                                        while (bj)
                                          for (; bo;)
                                            ;
                                if (aq)
                                  { 
                                    while (aj)
                                      ;
                                    continue;
                                  }
                                while (1)
                                  ;
                              }
                            while (!bj)
                              { 
                                al = 0;
                                for (; al < 6; al++)
                                  { 
                                    ai = 0;
                                    for (; ai < 60; ai = d (ai))
                                      { 
                                        k = !g || f / g;
                                        if (i)
                                          ay = 0;
                                        bc = j (q && *bq, ay);
                                        if (!n)
                                          ;
                                        else
                                          bd = bc / n;
                                        if (**bq)
                                          __builtin_abort ();
                                        *bp = !aa;
                                      }
                                    while (av)
                                      for (; ai; ai++)
                                        for (; ar; ar++)
                                          { 
                                            int cb;
                                            *aa = &cb;
                                          }
                                    m ((long) &br);
                                    while (an)
                                      while (1)
                                        ;
                                  }
                              }
                          }
                        o = b;
                      }
                    while (bs)
                      bm++;
                    while (bm)
                      ;
                  }
            }
        }
      goto ca;
    }
}

int main ()
{ 
  bf ();
  return 0;
}

Reply via email to