2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / pr55329.C
blob28a8a4d72facdfc15fc60564ea7b4d59fdabeffd
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" }
5 void *f1 ();
6 void f2 (void *);
7 void f3 ();
8 static inline void *
9 f4 ()
11   void *p = f1 ();
12   if (!p)
13     f3 ();
14   return p;
17 struct A
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; }
28 struct B : A
30   ~B () { a3 (); }
33 template <class T>
34 struct C
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 ();
43 class D
45   C <C <int> > c;
48 struct E
50   int *e;
51   ~E () { delete e; }
54 struct F
56   int *f1 ();
57   D f2;
58   E f3;
59   F () { f4 (); }
62 struct G : F
64   B g;
65   G () { g.a4 (*g1 ()->f1 ()); g1 ()->f1 (); }
66   F *g1 ();
69 void
70 foo ()
72   G g;