Debian Codegraph @

gcc/testsuite/g++.dg/opt/pr55329.C

raw
1 // PR tree-optimization/55329
2 // { dg-do compile }
3 // { dg-options "-O -fno-guess-branch-probability -fnon-call-exceptions --param=early-inlining-insns=111" }
4
5 void *f1 ();
6 void f2 (void *);
7 void f3 ();
8 static inline void *
9 f4 ()
10 {
11 void *p = f1 ();
12 if (!p)
13 f3 ();
14 return p;
15 }
16
17 struct A
18 {
19 int *a;
20 A ();
21 ~A () { a3 (); }
22 int a1 (int * p) { if (!p) f3 (); f2 (p); return 0; }
23 int *a2 ();
24 void a3 () { if (*a) a1 (a); }
25 int a4 (int x) { if (*a) f4 (); *a2 () += x; return 0; }
26 };
27
28 struct B : A
29 {
30 ~B () { a3 (); }
31 };
32
33 template <class T>
34 struct C
35 {
36 T *c;
37 C ();
38 int c1 () { return *(int *) f4 (); }
39 ~C () { if (c1 ()) for (T *t = c + c2 (); t != c; t--) T (); }
40 int c2 ();
41 };
42
43 class D
44 {
45 C <C <int> > c;
46 };
47
48 struct E
49 {
50 int *e;
51 ~E () { delete e; }
52 };
53
54 struct F
55 {
56 int *f1 ();
57 D f2;
58 E f3;
59 F () { f4 (); }
60 };
61
62 struct G : F
63 {
64 B g;
65 G () { g.a4 (*g1 ()->f1 ()); g1 ()->f1 (); }
66 F *g1 ();
67 };
68
69 void
70 foo ()
71 {
72 G g;
73 }