summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr36745.C
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/g++.dg/torture/pr36745.C
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/g++.dg/torture/pr36745.C')
-rw-r--r--gcc/testsuite/g++.dg/torture/pr36745.C122
1 files changed, 122 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/pr36745.C b/gcc/testsuite/g++.dg/torture/pr36745.C
new file mode 100644
index 000000000..53845aaa7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr36745.C
@@ -0,0 +1,122 @@
+/* PR target/36745 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target fpic } */
+
+typedef __SIZE_TYPE__ size_t;
+class QBasicAtomicInt
+{
+public:
+ int _q_value;
+ inline bool operator== (int value) const
+ {
+ }
+ bool ref ();
+ bool deref ();
+};
+inline bool
+QBasicAtomicInt::ref ()
+{
+ __asm__ ("": "=m" (_q_value): :);
+ return true;
+}
+
+namespace std
+{
+ using::size_t;
+}
+extern "C++"
+{
+ inline void *operator new (std::size_t, void *__p)
+ {
+ return __p;
+ }
+}
+struct QMapData
+{
+ QBasicAtomicInt ref;
+ static QMapData shared_null;
+};
+template < class Key, class T > class QMap
+{
+ QMapData *d;
+public: inline QMap ():d (&QMapData::shared_null)
+ {
+ }
+ inline ~ QMap ()
+ {
+ if (!d->ref.deref ())
+ freeData (d);
+ }
+ void freeData (QMapData * d);
+};
+struct QVectorData
+{
+ QBasicAtomicInt ref;
+ static QVectorData shared_null;
+};
+template < typename T > struct QVectorTypedData
+{
+ QBasicAtomicInt ref;
+};
+template < typename T > class QVector
+{
+ union
+ {
+ QVectorData *p;
+ QVectorTypedData < T > *d;
+ };
+public: inline QVector ():p (&QVectorData::shared_null)
+ {
+ d->ref.ref ();
+ }
+ inline void detach ()
+ {
+ if (d->ref == 1)
+ detach_helper ();
+ }
+ inline T *data ()
+ {
+ detach ();
+ }
+ T & operator[](int i);
+ void detach_helper ();
+ void realloc ();
+};
+template < typename T > void QVector < T >::detach_helper ()
+{
+ realloc ();
+}
+
+template < typename T > inline T & QVector < T >::operator[](int i)
+{
+ return data ()[i];
+}
+template < typename T > void QVector < T >::realloc ()
+{
+ T *j, *i;
+ i->~T ();
+ while (j-- == i)
+ new (j) T;
+}
+
+void
+mergeInto (QVector < int >*a)
+{
+};
+struct QRegExpAutomatonState
+{
+ QVector < int >outs;
+ QMap < int, int >reenter;
+ QMap < int, int >anchors;
+};
+class QRegExpEngine
+{
+ void addCatTransitions ();
+ QVector < QRegExpAutomatonState > s;
+};
+void
+QRegExpEngine::addCatTransitions ()
+{
+ mergeInto (&s[2].outs);
+}