2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / 20040609-1.c
blobef181476e37b44d5ba192a5470daeb5f1c1e5a60
1 /* PRs target/15569, rtl-optimization/15681 */
2 /* { dg-do compile } */
3 /* { dg-options "-Os -frename-registers" } */
4 /* { dg-options "-mconstant-gp -Os -frename-registers" { target ia64-*-* } } */
6 struct S { struct S *a, *b; };
7 struct T { struct S e; unsigned long a; int b, c; void *d; } f;
9 unsigned long f1 (unsigned long);
10 void f2 (int, struct T *);
11 void *f3 (void *);
12 unsigned long volatile g;
14 static void
15 f4 (struct T *p)
17 f1 (f1 (((unsigned long) g - p->a) >> 20));
20 static struct T *
21 f5 (void)
23 struct T *g, *p;
24 struct T *q = 0;
25 for (g = p = &f; (g = p = (struct T *) (g->e.a)) != &f;)
26 if (p->b)
28 f4 (p);
29 if (p->c & 0x80000)
30 return p;
32 return q;
35 static void
36 f6 (struct T *p)
38 f2 (9, p);
41 static inline void *
42 f7 (struct T *t)
44 void *d;
45 d = t->d;
46 if (d)
47 d = f3 (d);
48 return d;
51 static void *
52 f8 (struct T *p)
54 void *d = f7 (p);
55 if (!d)
56 return 0;
57 f6 (p);
58 return d;
61 static void
62 f9 (void)
64 struct T *p;
65 p = f5 ();
66 f8 (p);
69 void
70 test (void)
72 f9 ();