Document gcov-io (PR gcov-profile/84735).
[official-gcc.git] / gcc / testsuite / gcc.dg / 20020426-2.c
blob9ad7a54f6016e78aaf301653c755a00e0ff061ce
1 /* PR optimization/6475
2 Distilled from zlib sources. */
3 /* { dg-do run } */
4 /* { dg-options "-O2" } */
5 /* { dg-options "-O2 -frename-registers -fomit-frame-pointer -fPIC -mtune=i686" { target { { i?86-*-* x86_64-*-* } && { ia32 && fpic } } } } */
7 extern void exit (int);
9 typedef struct
11 union
13 struct
15 unsigned char a3;
16 unsigned char a4;
17 } a2;
18 unsigned int a5;
19 } a0;
20 unsigned int a1;
21 } A;
23 static int
24 foo (unsigned int *b, unsigned int n, unsigned int s, const unsigned int *d,
25 const unsigned int *e, A **t, unsigned int *m, A *hp, unsigned int *hn,
26 unsigned int *v)
28 unsigned int a, c[15 + 1], f;
29 int g, h;
30 unsigned int i, j, k;
31 int l;
32 unsigned int ee;
33 unsigned int *p;
34 A *q, r, *u[15];
35 int w;
36 unsigned int x[15 + 1], *xx;
37 int y;
38 unsigned int z;
39 p = c;
40 *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
41 *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
42 *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
43 *p++ = 0; *p++ = 0; *p++ = 0; *p++ = 0;
44 p = b;
45 i = n;
47 c[*p++]++;
48 while (--i);
49 if (c[0] == n)
51 *t = (A *) 0;
52 *m = 0;
53 return 0;
55 l = *m;
56 for (j = 1; j <= 15; j++)
57 if (c[j])
58 break;
59 k = j;
60 if ((unsigned int) l < j)
61 l = j;
62 for (i = 15; i; i--)
63 if (c[i])
64 break;
65 g = i;
66 if ((unsigned int) l > i)
67 l = i;
68 *m = l;
69 for (y = 1 << j; j < i; j++, y <<= 1)
70 if ((y -= c[j]) < 0)
71 return -3;
72 if ((y -= c[i]) < 0)
73 return -3;
74 c[i] += y;
75 x[1] = j = 0;
76 p = c + 1;
77 xx = x + 2;
78 while (--i)
79 *xx++ = (j += *p++);
80 p = b;
81 i = 0;
83 if ((j = *p++) != 0)
84 v[x[j]++] = i;
85 while (++i < n);
86 n = x[g];
87 x[0] = i = 0;
88 p = v;
89 h = -1;
90 w = -l;
91 u[0] = (A *) 0;
92 q = (A *) 0;
93 z = 0;
94 for (; k <= g; k++)
96 a = c[k];
97 while (a--)
99 while (k > w + l)
101 h++;
102 w += l;
103 z = g - w;
104 z = z > (unsigned int) l ? l : z;
105 if ((f = 1 << (j = k - w)) > a + 1)
107 f -= a + 1;
108 xx = c + k;
109 if (j < z)
110 while (++j < z)
112 if ((f <<= 1) <= *++xx)
113 break;
114 f -= *xx;
117 z = 1 << j;
118 if (*hn + z > 1440)
119 return -3;
120 u[h] = q = hp + *hn;
121 *hn += z;
122 if (h)
124 x[h] = i;
125 r.a0.a2.a4 = (unsigned char) l;
126 r.a0.a2.a3 = (unsigned char) j;
127 j = i >> (w - l);
128 r.a1 = (unsigned int) (q - u[h - 1] - j);
129 u[h - 1][j] = r;
131 else
132 *t = q;
134 r.a0.a2.a4 = (unsigned char) (k - w);
135 if (p >= v + n)
136 r.a0.a2.a3 = 128 + 64;
137 else if (*p < s)
139 r.a0.a2.a3 = (unsigned char) (*p < 256 ? 0 : 32 + 64);
140 r.a1 = *p++;
142 else
144 r.a0.a2.a3 = (unsigned char) (e[*p - s] + 16 + 64);
145 r.a1 = d[*p++ - s];
147 f = 1 << (k - w);
148 for (j = i >> w; j < z; j += f)
149 q[j] = r;
150 for (j = 1 << (k - 1); i & j; j >>= 1)
151 i ^= j;
152 i ^= j;
153 ee = (1 << w) - 1;
154 while ((i & ee) != x[h])
156 h--;
157 w -= l;
158 ee = (1 << w) - 1;
162 return y != 0 && g != 1 ? (-5) : 0;
165 unsigned int a[19] = { 3, 4, 0, 2, 2, [17] = 3, 3 };
166 unsigned int d[19];
167 A h[1440];
170 main (void)
172 unsigned int b = 0, c = 0;
173 A *e = 0;
174 foo (a, 19, 19, 0, 0, &e, &b, h, &c, d);
175 exit (0);