PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr40022.c
blob1e8f728ab4438415067610fae652ea79bc6d5a60
1 extern void abort (void);
3 struct A
5 struct A *a;
6 };
8 struct B
10 struct A *b;
13 __attribute__((noinline))
14 struct A *
15 foo (struct A *x)
17 asm volatile ("" : : "g" (x) : "memory");
18 return x;
21 __attribute__((noinline))
22 void
23 bar (struct B *w, struct A *x, struct A *y, struct A *z)
25 struct A **c;
26 c = &w->b;
27 *c = foo (x);
28 while (*c)
29 c = &(*c)->a;
30 *c = foo (y);
31 while (*c)
32 c = &(*c)->a;
33 *c = foo (z);
36 struct B d;
37 struct A e, f, g;
39 int
40 main (void)
42 f.a = &g;
43 bar (&d, &e, &f, 0);
44 if (d.b == 0
45 || d.b->a == 0
46 || d.b->a->a == 0
47 || d.b->a->a->a != 0)
48 abort ();
49 return 0;