modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/20020129-1.c (about)

     1  /* This testcase failed at -O2 on IA-64, because scheduling did not take
     2     into account conditional execution when using cselib for alias
     3     analysis.  */
     4  
     5  struct D { int d1; struct D *d2; };
     6  struct C { struct D c1; long c2, c3, c4, c5, c6; };
     7  struct A { struct A *a1; struct C *a2; };
     8  struct B { struct C b1; struct A *b2; };
     9  
    10  extern void abort (void);
    11  extern void exit (int);
    12  
    13  void
    14  foo (struct B *x, struct B *y)
    15  {
    16    if (x->b2 == 0)
    17      {
    18        struct A *a;
    19  
    20        x->b2 = a = y->b2;
    21        y->b2 = 0;
    22        for (; a; a = a->a1)
    23  	a->a2 = &x->b1;
    24      }
    25  
    26    if (y->b2 != 0)
    27      abort ();
    28  
    29    if (x->b1.c3 == -1)
    30      {
    31        x->b1.c3 = y->b1.c3;
    32        x->b1.c4 = y->b1.c4;
    33        y->b1.c3 = -1;
    34        y->b1.c4 = 0;
    35      }
    36  
    37    if (y->b1.c3 != -1)
    38      abort ();
    39  }
    40  
    41  struct B x, y;
    42  
    43  int main ()
    44  {
    45    y.b1.c1.d1 = 6;
    46    y.b1.c3 = 145;
    47    y.b1.c4 = 2448;
    48    x.b1.c3 = -1;
    49    foo (&x, &y);
    50    exit (0);
    51  }