modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/compile/20011130-2.c (about)

     1  /* This testcase caused infinite loop in life info computation
     2     after if conversion on IA-64.  Conditional register dead for
     3     pseudo holding sign-extended k was improperly computed,
     4     resulting in this pseudo being live at start of bb if it was
     5     dead at the end and vice versa; as it was a bb which had edge
     6     to itself, this resulted in alternative propagating this basic
     7     block forever.  */
     8  
     9  typedef struct {
    10    unsigned char a;
    11    unsigned char b;
    12  } S0;
    13  
    14  typedef struct {
    15    S0 *c;
    16    int d;
    17    unsigned int e;
    18    unsigned char *f[3];
    19    void *g;
    20  } S1;
    21  
    22  int bar (int, void *);
    23  
    24  int foo (S1 *x, float y)
    25  {
    26    S0 *h;
    27    int i, j, k, l, m;
    28    float n, o, p;
    29    unsigned char *q, *r[3];
    30  
    31    h = x->c;
    32    m = h->a;
    33    l = h->b;
    34    n = y;
    35    o = 0.0;
    36    if (x->d == 8)
    37      for (j = 0; j < x->e; j++)
    38        for (k = 0; k < 3; k++)
    39  	{
    40  	  n = y;
    41  	  o = 0.0;
    42  	  if (m)
    43  	    q = x->f[k] + x->e - 1 - j;
    44  	  else
    45  	    q = x->f[k] + j;
    46  	  p = (*q - o) * y / (n - o);
    47  	  p = 0.0 > p ? 0.0 : p;
    48  	  p = y < p ? y : p;
    49  	  if (l)
    50  	    p = r[k][(int) p];
    51  	  bar (p, x->g);
    52  	}
    53    return 1;
    54  }