Skip to content

Commit f9ff478

Browse files
committed
testsuite: add testcase for fixed PR117546
PR117546 was fixed by Eric's r14-10693-gadab597af288d6 change, but the testcase here is sufficiently different to be worth including in torture/. gcc/testsuite/ChangeLog: PR ipa/117546 * gcc.dg/torture/pr117546.c: New test.
1 parent e58b0dd commit f9ff478

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* { dg-do run } */
2+
3+
typedef struct {
4+
int a;
5+
int b;
6+
} c;
7+
8+
typedef struct {
9+
int a;
10+
int b;
11+
int d;
12+
} e;
13+
14+
typedef struct {
15+
int f;
16+
int g;
17+
} h;
18+
19+
typedef struct {
20+
h i[1];
21+
e coords[100];
22+
} j;
23+
24+
struct k {
25+
j glyf;
26+
} l;
27+
28+
int m, n;
29+
double o;
30+
e *q;
31+
e r;
32+
33+
int s(c *v) {
34+
if (v[0].a == m)
35+
__builtin_abort();
36+
int t = v[0].a + v[2].b * (v[2].b - v[0].b),
37+
u = (2. + v[4].b - v[2].b) * (v[4].b - v[2].b);
38+
if (t <= 3 * u) {
39+
v[0] = v[4];
40+
return 1;
41+
}
42+
return 0;
43+
}
44+
45+
void w(struct k *v) {
46+
c p[5];
47+
e *a = &v->glyf.coords[0];
48+
if (a->d)
49+
p[0].a = p[0].b = a->b;
50+
q = &r;
51+
o = p[0].b;
52+
while (v->glyf.i[0].g--) {
53+
q = q == &r ? a : q + 1;
54+
if (q->d)
55+
switch (n) {
56+
case 2:
57+
p[4].a = q->a;
58+
p[4].b = q->b;
59+
n = s(p);
60+
}
61+
else
62+
switch (n) {
63+
case 0:
64+
n = 1;
65+
break;
66+
case 1:
67+
p[2].b = q->b;
68+
n = 2;
69+
break;
70+
case 2:
71+
if (s(p))
72+
n = 1;
73+
}
74+
}
75+
}
76+
77+
int main() {
78+
l.glyf.i[0] = (h){0, 26};
79+
l.glyf.coords[0] = (e){4, 2, 3};
80+
l.glyf.coords[3] = (e){2, 126, 3};
81+
l.glyf.coords[4] = (e){2, 206};
82+
l.glyf.coords[6] = (e){0, 308, 5};
83+
w(&l);
84+
}

0 commit comments

Comments
 (0)