summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr48271.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/torture/pr48271.C')
-rw-r--r--gcc/testsuite/g++.dg/torture/pr48271.C119
1 files changed, 119 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr48271.C b/gcc/testsuite/g++.dg/torture/pr48271.C
new file mode 100644
index 00000000000..5b60ccd768c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr48271.C
@@ -0,0 +1,119 @@
+// { dg-do compile }
+// { dg-options "-ftree-vrp -fno-guess-branch-probability -fnon-call-exceptions" }
+
+void *xalloc ();
+void xfree (void *);
+void error ();
+
+static inline void *
+MallocT ()
+{
+ void *p = xalloc ();
+ if (!p)
+ error ();
+ return p;
+}
+
+
+struct ByteBlob
+{
+ int *header;
+
+ ByteBlob();
+
+ ~ByteBlob ()
+ {
+ Free ();
+ }
+
+ int RawFree (int * p)
+ {
+ if (!p)
+ error ();
+ xfree (p);
+ }
+
+ int *LengthRef ();
+
+ void Free ()
+ {
+ if (*header)
+ RawFree (header);
+ }
+
+ int Append (int num_ints)
+ {
+ if (*header)
+ MallocT ();
+ *LengthRef () += num_ints;
+ }
+};
+
+struct CBlobT:ByteBlob
+{
+ ~CBlobT ()
+ {
+ Free ();
+ }
+};
+
+template < class T > struct FixedSizeArray
+{
+ int HeaderSize;
+ T *data;
+ FixedSizeArray ();
+ int RefCnt ()
+ {
+ return *(int *) MallocT ();
+ }
+ ~FixedSizeArray ()
+ {
+ if (RefCnt ())
+ for (T * pItem = data + Length (); pItem != data; pItem--)
+ T ();
+ }
+ int Length ();
+};
+
+class SmallArray
+{
+ typedef FixedSizeArray < int > SubArray;
+ typedef FixedSizeArray < SubArray > SuperArray;
+ SuperArray data;
+};
+
+struct CHashTableT
+{
+ int *m_slots;
+ ~CHashTableT ()
+ {
+ delete m_slots;
+ }
+};
+
+struct CYapfBaseT
+{
+ int *PfGetSettings ();
+ SmallArray m_arr;
+ CHashTableT m_closed;
+ CYapfBaseT ()
+ {
+ MallocT ();
+ }
+};
+
+struct CYapfCostRailT:CYapfBaseT
+{
+ CBlobT m_sig_look_ahead_costs;
+ CYapfCostRailT ()
+ {
+ m_sig_look_ahead_costs.Append (*Yapf ()->PfGetSettings ());
+ Yapf ()->PfGetSettings ();
+ }
+ CYapfBaseT *Yapf ();
+};
+
+void stCheckReverseTrain ()
+{
+ CYapfCostRailT pf1;
+}