]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libobjc/36610 (objc_msg_sendv is broken for targets which pass argument via...
authorAndrew Pinski <pinskia@gmail.com>
Mon, 29 Dec 2008 02:16:45 +0000 (18:16 -0800)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Mon, 29 Dec 2008 02:16:45 +0000 (18:16 -0800)
2008-12-28  Andrew Pinski  <pinskia@gmail.com>

        PR libobjc/36610
        * objc/execute/forward-1.m: New test.

From-SVN: r142945

gcc/testsuite/ChangeLog
gcc/testsuite/objc/execute/forward-1.m [new file with mode: 0644]

index 7f5c20cda6f161900fedaf20989284598abd48cc..42cc3da1a8bf567d9340b8e9c63ace18e8d52c40 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-28  Andrew Pinski  <pinskia@gmail.com>
+
+       PR libobjc/36610
+       * objc/execute/forward-1.m: New test.
+
 2008-12-27  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/38633
diff --git a/gcc/testsuite/objc/execute/forward-1.m b/gcc/testsuite/objc/execute/forward-1.m
new file mode 100644 (file)
index 0000000..9306dea
--- /dev/null
@@ -0,0 +1,85 @@
+/* See if -forward::/-performv:: is able to work. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <objc/Object.h>
+#include <objc/objc-api.h>
+
+#define VALUETOUSE 1234567890
+
+#ifdef __NEXT_RUNTIME__
+/* Does not run with the next runtime. */
+int main(void)
+{
+  return 0;
+}
+
+#else
+
+id forwarder, receiver;
+
+@interface Forwarder: Object
+{
+    id receiver;
+}
+
+-initWithReceiver:theReceiver;
+
+@end
+
+@interface Receiver:Object
+{
+    int foo;
+}
+-display;
+-initWithFoo:(int)theFoo;
+@end
+@implementation Receiver
+
+-initWithFoo: (int)theFoo
+{
+    foo = theFoo;
+    return self;
+}
+
+-display
+{
+    /* Check to see if we are really the reciever. */
+    if (self != receiver)
+        abort ();
+    /* And the value of foo is set correctly. */
+    if (foo != VALUETOUSE)
+      abort ();
+    return self;
+}
+
+@end
+
+@implementation Forwarder
+-initWithReceiver: theReceiver
+{
+    [super init];
+    receiver = theReceiver;
+    return self;
+}
+-(retval_t) forward: (SEL)theSel: (arglist_t)theArgFrame
+{
+  /* If we have a reciever try to perform on that object */
+    if (receiver)
+        return [receiver performv: theSel: theArgFrame];
+    return [self doesNotRecognize:theSel];
+}
+@end
+int main()
+{
+    /* Init the reciever. */
+    receiver = [[Receiver alloc] initWithFoo: VALUETOUSE];
+    /* Init the fowarder. */
+    forwarder = [[Forwarder alloc] initWithReceiver: receiver];
+    /* Call display on the forwarder which in turns calls display on
+       the reciever. */
+    [forwarder display];
+    exit(0);
+}
+
+#endif