Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-prof / 20041218-1.c
blobcbd1c7c80ecf63d14a750f7e582865492cd9408a
1 /* PR rtl-optimization/16968 */
2 /* Testcase by Jakub Jelinek <jakub@redhat.com> */
3 /* { dg-require-effective-target freorder } */
4 /* { dg-options "-O2 -freorder-blocks-and-partition" } */
6 struct T
8 unsigned int b, c, *d;
9 unsigned char e;
11 struct S
13 unsigned int a;
14 struct T f;
16 struct U
18 struct S g, h;
20 struct V
22 unsigned int i;
23 struct U j;
26 extern void exit (int);
27 extern void abort (void);
29 void *
30 dummy1 (void *x)
32 return "";
35 void *
36 dummy2 (void *x, void *y)
38 exit (0);
41 struct V *
42 baz (unsigned int x)
44 static struct V v;
45 __builtin_memset (&v, 0x55, sizeof (v));
46 return &v;
49 int
50 check (void *x, struct S *y)
52 if (y->a || y->f.b || y->f.c || y->f.d || y->f.e)
53 abort ();
54 return 1;
57 static struct V *
58 bar (unsigned int x, void *y)
60 const struct T t = { 0, 0, (void *) 0, 0 };
61 struct V *u;
62 void *v;
63 v = dummy1 (y);
64 if (!v)
65 return (void *) 0;
67 u = baz (sizeof (struct V));
68 u->i = x;
69 u->j.g.a = 0;
70 u->j.g.f = t;
71 u->j.h.a = 0;
72 u->j.h.f = t;
74 if (!check (v, &u->j.g) || !check (v, &u->j.h))
75 return (void *) 0;
76 return u;
79 int
80 foo (unsigned int *x, unsigned int y, void **z)
82 void *v;
83 unsigned int i, j;
85 *z = v = (void *) 0;
87 for (i = 0; i < y; i++)
89 struct V *c;
91 j = *x;
93 switch (j)
95 case 1:
96 c = bar (j, x);
97 break;
98 default:
99 c = 0;
100 break;
102 if (c)
103 v = dummy2 (v, c);
104 else
105 return 1;
108 *z = v;
109 return 0;
113 main (void)
115 unsigned int one = 1;
116 void *p;
117 foo (&one, 1, &p);
118 abort ();