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