This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Bug in ObjC?
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: Bug in ObjC?
- From: Axel Friedrich <friedrich_axel at gmx dot de>
- Date: Thu, 8 Jul 1999 15:49:53 +0200 (MEST)
- Cc: axel at sfb288 dot math dot tu-berlin dot de
Hi,
I think that I have discovered a bug in Objective-C.
The following program runs with the egcs-1.1.1 compiler
but generates a core dump if I compile it with egcs-1.1.2
und Linux 2.2. It seems that the forward-mechanism has
problems with arguments. The programm should generate
the output
method of A
method of A
The first output stems from a method-call via the forward-
method WITHOUT any arguments whereas the second output
stems from a method-call via the forward-method WITH an
argument. With egcs-1.1.1 I get both lines of output but
with the egcs-1.1.2 the program crashes during the second
method method call.
Ciao
Axel
---------------------------------------------------------
#include <objc/Object.h>
#include <stdio.h>
@interface A : Object {
}
- methodOfA;
- otherMethodOfA: object;
@end
@interface B : Object {
}
@end
@implementation A
- methodOfA {
printf("method of A\n");
return self;
}
- otherMethodOfA: object {
return [object methodOfA];
}
@end
@implementation B
- (retval_t)forward :(SEL)aSelector :(arglist_t)argFrame {
A *anA = [A new];
if ( [anA respondsTo:aSelector])
return [ anA performv: aSelector: argFrame];
else
printf("Unknown\n");
return nil;
}
@end
int main() {
[ [B new] methodOfA ];
[ [B new] otherMethodOfA: [A new] ];
return 1;
}
--
Sent through Global Message Exchange - http://www.gmx.net