Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr48271.C

raw
1 // { dg-do compile }
2 // { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions -Wno-return-type" }
3
4 void *xalloc ();
5 void xfree (void *);
6 void error ();
7
8 static inline void *
9 MallocT ()
10 {
11 void *p = xalloc ();
12 if (!p)
13 error ();
14 return p;
15 }
16
17
18 struct ByteBlob
19 {
20 int *header;
21
22 ByteBlob();
23
24 ~ByteBlob ()
25 {
26 Free ();
27 }
28
29 int RawFree (int * p)
30 {
31 if (!p)
32 error ();
33 xfree (p);
34 }
35
36 int *LengthRef ();
37
38 void Free ()
39 {
40 if (*header)
41 RawFree (header);
42 }
43
44 int Append (int num_ints)
45 {
46 if (*header)
47 MallocT ();
48 *LengthRef () += num_ints;
49 }
50 };
51
52 struct CBlobT:ByteBlob
53 {
54 ~CBlobT ()
55 {
56 Free ();
57 }
58 };
59
60 template < class T > struct FixedSizeArray
61 {
62 int HeaderSize;
63 T *data;
64 FixedSizeArray ();
65 int RefCnt ()
66 {
67 return *(int *) MallocT ();
68 }
69 ~FixedSizeArray ()
70 {
71 if (RefCnt ())
72 for (T * pItem = data + Length (); pItem != data; pItem--)
73 T ();
74 }
75 int Length ();
76 };
77
78 class SmallArray
79 {
80 typedef FixedSizeArray < int > SubArray;
81 typedef FixedSizeArray < SubArray > SuperArray;
82 SuperArray data;
83 };
84
85 struct CHashTableT
86 {
87 int *m_slots;
88 ~CHashTableT ()
89 {
90 delete m_slots;
91 }
92 };
93
94 struct CYapfBaseT
95 {
96 int *PfGetSettings ();
97 SmallArray m_arr;
98 CHashTableT m_closed;
99 CYapfBaseT ()
100 {
101 MallocT ();
102 }
103 };
104
105 struct CYapfCostRailT:CYapfBaseT
106 {
107 CBlobT m_sig_look_ahead_costs;
108 CYapfCostRailT ()
109 {
110 m_sig_look_ahead_costs.Append (*Yapf ()->PfGetSettings ());
111 Yapf ()->PfGetSettings ();
112 }
113 CYapfBaseT *Yapf ();
114 };
115
116 void stCheckReverseTrain ()
117 {
118 CYapfCostRailT pf1;
119 }