(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
20071210-1.c
       1  /* PR rtl-optimization/34302 */
       2  /* { dg-require-effective-target label_values } */
       3  /* { dg-require-effective-target indirect_jumps } */
       4  
       5  extern void abort (void);
       6  
       7  struct S
       8  {
       9    int n1, n2, n3, n4;
      10  };
      11  
      12  __attribute__((noinline)) struct S
      13  foo (int x, int y, int z)
      14  {
      15    if (x != 10 || y != 9 || z != 8)
      16      abort ();
      17    struct S s = { 1, 2, 3, 4 };
      18    return s;
      19  }
      20  
      21  __attribute__((noinline)) void **
      22  bar (void **u, int *v)
      23  {
      24    void **w = u;
      25    int *s = v, x, y, z;
      26    void **p, **q;
      27    static void *l[] = { &&lab1, &&lab1, &&lab2, &&lab3, &&lab4 };
      28  
      29    if (!u)
      30      return l;
      31  
      32    q = *w++;
      33    goto *q;
      34  lab2:
      35    p = q;
      36    q = *w++;
      37    x = s[2];
      38    y = s[1];
      39    z = s[0];
      40    s -= 1;
      41    struct S r = foo (x, y, z);
      42    s[3] = r.n1;
      43    s[2] = r.n2;
      44    s[1] = r.n3;
      45    s[0] = r.n4;
      46    goto *q;
      47  lab3:
      48    p = q;
      49    q = *w++;
      50    s += 1;
      51    s[0] = 23;
      52  lab1:
      53    goto *q;
      54  lab4:
      55    return 0;
      56  }
      57  
      58  int
      59  main (void)
      60  {
      61    void **u = bar ((void **) 0, (int *) 0);
      62    void *t[] = { u[2], u[4] };
      63    int s[] = { 7, 8, 9, 10, 11, 12 };
      64    if (bar (t, &s[1]) != (void **) 0
      65        || s[0] != 4 || s[1] != 3 || s[2] != 2 || s[3] != 1
      66        || s[4] != 11 || s[5] != 12)
      67      abort ();
      68    return 0;
      69  }