2008-11-15 Richard Guenther <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20071210-1.c
blob0d113c008f7977c628d0e282b32ee58d9fcdf265
1 /* PR rtl-optimization/34302 */
3 extern void abort (void);
5 struct S
7 int n1, n2, n3, n4;
8 };
10 __attribute__((noinline)) struct S
11 foo (int x, int y, int z)
13 if (x != 10 || y != 9 || z != 8)
14 abort ();
15 struct S s = { 1, 2, 3, 4 };
16 return s;
19 __attribute__((noinline)) void **
20 bar (void **u, int *v)
22 void **w = u;
23 int *s = v, x, y, z;
24 void **p, **q;
25 static void *l[] = { &&lab1, &&lab1, &&lab2, &&lab3, &&lab4 };
27 if (!u)
28 return l;
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;
56 int
57 main (void)
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;