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