1193323Sedextern void abort (void);
2193323Sed
3193323Sedstruct A
4193323Sed{
5193323Sed  struct A *a;
6193323Sed};
7193323Sed
8193323Sedstruct B
9193323Sed{
10193323Sed  struct A *b;
11193323Sed};
12193323Sed
13193323Sed__attribute__((noinline))
14193323Sedstruct A *
15252723Sdimfoo (struct A *x)
16235633Sdim{
17235633Sdim  asm volatile ("" : : "g" (x) : "memory");
18252723Sdim  return x;
19252723Sdim}
20252723Sdim
21252723Sdim__attribute__((noinline))
22235633Sdimvoid
23198090Srdivackybar (struct B *w, struct A *x, struct A *y, struct A *z)
24226890Sdim{
25263509Sdim  struct A **c;
26193323Sed  c = &w->b;
27193323Sed  *c = foo (x);
28224145Sdim  while (*c)
29224145Sdim    c = &(*c)->a;
30224145Sdim  *c = foo (y);
31193323Sed  while (*c)
32193323Sed    c = &(*c)->a;
33252723Sdim  *c = foo (z);
34252723Sdim}
35224145Sdim
36224145Sdimstruct B d;
37224145Sdimstruct A e, f, g;
38224145Sdim
39193323Sedint
40224145Sdimmain (void)
41224145Sdim{
42224145Sdim  f.a = &g;
43224145Sdim  bar (&d, &e, &f, 0);
44224145Sdim  if (d.b == 0
45235633Sdim      || d.b->a == 0
46235633Sdim      || d.b->a->a == 0
47235633Sdim      || d.b->a->a->a != 0)
48235633Sdim    abort ();
49235633Sdim  return 0;
50235633Sdim}
51235633Sdim
52235633Sdim