This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix Blackfin MI thunks


Bernd Schmidt wrote:
We were using R2 as a scratch register, which is unfortunate since it's the third argument register. Changed to R3, committed as 122376. Interestingly this wasn't caught by the g++ testsuite and showed up in a larger application.

I've also checked in a new testcase for this. It's probably more complicated than it needs to be; instead of trying to think about in which cases we use thunks, I just added stuff until the testcase failed (without the previous patch).


Committed after regression testing on bfin-elf.


Bernd -- This footer brought to you by insane German lawmakers. Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen Registergericht Muenchen HRB 40368 Geschaeftsfuehrer Thomas Wessel, Vincent Roche, Joseph E. McDonough
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 122395)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2007-02-28  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+	* g++.dg/inherit/thunk7.C: New test.
+
 2007-02-27  Uros Bizjak  <ubizjak@gmail.com>
 
 	PR target/30970
Index: g++.dg/inherit/thunk7.C
===================================================================
--- g++.dg/inherit/thunk7.C	(revision 0)
+++ g++.dg/inherit/thunk7.C	(revision 0)
@@ -0,0 +1,55 @@
+// { dg-do run }
+
+#include <stdlib.h>
+
+class A
+{
+    int a, b;
+public:
+    virtual void foo (int a, int b, int c, int d);
+};
+
+class B
+{
+    int c, d;
+public:
+    virtual void bar (int a, int b, int c, int d);
+};
+
+class D : public virtual A, public virtual B
+{
+    int e, f;
+};
+
+void A::foo(int a, int b, int c, int d)
+{
+    if (a != 1 || b != 2 || c != 3 || d != 4)
+	abort ();
+}
+
+void B::bar (int a, int b, int c, int d)
+{
+    if (a != 5 || b != 6 || c != 7 || d != 8)
+	abort ();
+}
+
+class C: private D, public virtual A, public virtual B
+{
+public:
+    virtual void foo (int a, int b, int c, int d) { A::foo (a, b, c, d); D::A::foo (a, b, c, d); }
+    virtual void bar (int a, int b, int c, int d) { B::bar (a, b, c, d); D::B::bar (a, b, c, d); }
+};
+
+C c1;
+C *c2 = &c1;
+A *c3 = &c1;
+B *c4 = &c1;
+
+int main()
+{
+    c2->foo (1, 2, 3, 4);
+    c2->bar (5, 6, 7, 8);
+    c3->foo (1, 2, 3, 4);
+    c4->bar (5, 6, 7, 8);
+    return 0;
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]