re PR target/71571 ([CRIS] Multiple inheritance non-virtual PIC thunk causes crash)
authorDavid B. Robins <gcc@davidrobins.net>
Mon, 20 Jun 2016 20:02:03 +0000 (20:02 +0000)
committerHans-Peter Nilsson <hp@gcc.gnu.org>
Mon, 20 Jun 2016 20:02:03 +0000 (20:02 +0000)
PR target/71571
* g++.dg/torture/pr71571.C: New test.

From-SVN: r237616

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr71571.C [new file with mode: 0755]

index d2963c3fe4a6db55a3a9a209598b494b3d3f69fe..96b664d39a54f85b00d16368be1a9c432a6574bd 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-20   David B. Robins  <gcc@davidrobins.net>
+
+       PR target/71571
+       * g++.dg/torture/pr71571.C: New test.
+
 2016-06-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/71559
diff --git a/gcc/testsuite/g++.dg/torture/pr71571.C b/gcc/testsuite/g++.dg/torture/pr71571.C
new file mode 100755 (executable)
index 0000000..e60edcd
--- /dev/null
@@ -0,0 +1,43 @@
+// { dg-do run }
+// { dg-options "-fno-inline" { target { ! fpic } } }
+// { dg-options "-fpic -fno-inline" { target fpic } }
+
+class XBase
+{
+public:
+ virtual void FuncA() = 0;
+};
+
+class Y
+{
+protected:
+ virtual void FuncB() {}
+};
+
+class X1 : public Y, public XBase
+{
+public:
+ void FuncA() {}
+};
+
+class X2 : public XBase
+{
+public:
+ X2(XBase &xb) : m_xb(xb) { }
+ void FuncA()
+ {
+  m_xb.FuncA();
+ }
+
+private:
+ XBase &m_xb;
+};
+
+
+int main()
+{
+ X1 x1;
+ X2 x2(x1);
+ XBase *pxb = &x2;
+ pxb->FuncA();
+}