Debian Codegraph @

gcc/testsuite/g++.dg/debug/vartrack1.C

raw
1 // This testcase used to hang the compiler in vt_find_locations.
2 // { dg-do compile }
3 // { dg-options "-O2 -g" }
4
5 struct S
6 {
7 int a;
8 S *b, *c, *d;
9 };
10
11 struct T
12 {
13 void f1 (S *x);
14 void f2 (S *x);
15 void f3 (S *x, S *y);
16 S *e;
17 };
18
19 void
20 T::f3 (S *x, S *y)
21 {
22 while (x != this->e && (!x || x->a == 1))
23 {
24 if (x == y->c)
25 {
26 S *w = y->d;
27 if (w && w->a == 0)
28 {
29 w->a = 1;
30 y->a = 0;
31 f2 (y);
32 w = y->d;
33 }
34 if (w && (!w->c || w->c->a == 1) && (!w->d || w->d->a == 1))
35 {
36 w->a = 0;
37 x = y;
38 y = x->b;
39 }
40 else
41 {
42 if (w && (!w->d || w->d->a == 1))
43 {
44 if (w->c)
45 w->c->a = 1;
46 w->a = 0;
47 f1 (w);
48 w = y->d;
49 }
50 if (w)
51 {
52 w->a = y->a;
53 if (w->d)
54 w->d->a = 1;
55 }
56 y->a = 1;
57 f2 (y);
58 x = e;
59 }
60 }
61 else
62 {
63 S *w = y->c;
64 if (w && w->a == 0)
65 {
66 w->a = 1;
67 y->a = 0;
68 f1 (y);
69 w = y->c;
70 }
71 if (w && (!w->c || w->c->a == 1) && (!w->d || w->d->a == 1))
72 {
73 w->a = 0;
74 x = y;
75 y = x->b;
76 }
77 else
78 {
79 if (w && (!w->c || w->c->a == 1))
80 {
81 w->a = 0;
82 if (w->d)
83 w->d->a = 1;
84 f2 (w);
85 w = y->c;
86 }
87 if (w)
88 {
89 w->a = y->a;
90 if (w->c)
91 w->c->a = 1;
92 }
93 y->a = 1;
94 f1 (y);
95 x = e;
96 }
97 }
98 }
99 }