PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20041218-1.c
blob4d113e4557cae2e21e0374bef400d227f7f1cff1
1 /* PR rtl-optimization/16968 */
2 /* Testcase by Jakub Jelinek <jakub@redhat.com> */
4 struct T
6 unsigned int b, c, *d;
7 unsigned char e;
8 };
9 struct S
11 unsigned int a;
12 struct T f;
14 struct U
16 struct S g, h;
18 struct V
20 unsigned int i;
21 struct U j;
24 extern void exit (int);
25 extern void abort (void);
27 void *
28 dummy1 (void *x)
30 return "";
33 void *
34 dummy2 (void *x, void *y)
36 exit (0);
39 struct V *
40 baz (unsigned int x)
42 static struct V v;
43 __builtin_memset (&v, 0x55, sizeof (v));
44 return &v;
47 int
48 check (void *x, struct S *y)
50 if (y->a || y->f.b || y->f.c || y->f.d || y->f.e)
51 abort ();
52 return 1;
55 static struct V *
56 bar (unsigned int x, void *y)
58 const struct T t = { 0, 0, (void *) 0, 0 };
59 struct V *u;
60 void *v;
61 v = dummy1 (y);
62 if (!v)
63 return (void *) 0;
65 u = baz (sizeof (struct V));
66 u->i = x;
67 u->j.g.a = 0;
68 u->j.g.f = t;
69 u->j.h.a = 0;
70 u->j.h.f = t;
72 if (!check (v, &u->j.g) || !check (v, &u->j.h))
73 return (void *) 0;
74 return u;
77 int
78 foo (unsigned int *x, unsigned int y, void **z)
80 void *v;
81 unsigned int i, j;
83 *z = v = (void *) 0;
85 for (i = 0; i < y; i++)
87 struct V *c;
89 j = *x;
91 switch (j)
93 case 1:
94 c = bar (j, x);
95 break;
96 default:
97 c = 0;
98 break;
100 if (c)
101 v = dummy2 (v, c);
102 else
103 return 1;
106 *z = v;
107 return 0;
111 main (void)
113 unsigned int one = 1;
114 void *p;
115 foo (&one, 1, &p);
116 abort ();