From: <no...@so...> - 2002-05-28 23:57:39
|
Bugs item #561648, was opened at 2002-05-29 06:57 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=561648&group_id=2435 Category: gcc Group: Feature requests Status: Open Resolution: None Priority: 5 Submitted By: Aleksey Dukhnyakov (daa77) Assigned to: Danny Smith (dannysmith) Summary: __builtin_return returns bad result Initial Comment: Hello, I am using new version of gcc3.1, Please see my example. It works properly on gcc2.95-2 and gcc 2.95-3 $ gcc -v Reading specs from d:/mingw_new1/bin/../lib/gcc- lib/mingw32/3.1/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld - -with-gnu-as --host= mingw32 --target=mingw32 --prefix=/mingw --enable- threads --disable-nls --enable -languages=f77,c++,objc,ada --disable-win32-registry -- disable-shared Thread model: win32 gcc version 3.1 $ cat bug.m #include <objc/objc-api.h> #include <objc/Object.h> @interface MyObject : Object - (void *) print:(void *) value; @end @implementation MyObject - (void *) print:(void *) value { printf("-[MyObject print: 0x%x]\n",value); return (void*)((int)value+1); } @end id objc_msg_send_named(id object, char *opname, ...) { SEL op = sel_get_uid (opname); Method* m = class_get_instance_method(object- >class_pointer, op); IMP imp = objc_msg_lookup (object, op); arglist_t args; retval_t result; if (!m) return nil; args = __builtin_apply_args(); result = __builtin_apply((apply_t)imp, args, method_get_sizeof_arguments (m)); __builtin_return (result); } int main() { MyObject * obj = [MyObject new]; void * addr = (void*)0xFFFFFFEF; printf("-[obj print:0x%x] : 0x%x\n",addr,[obj print:(void *)addr]); printf("objc_msg_send_named :0x% x\n",objc_msg_send_named(obj,"print:",addr)); return 0; } $ gcc bug.m -lobjc $ a.exe -[MyObject print: 0xffffffef] -[obj print:0xffffffef] : 0xfffffff0 -[MyObject print: 0xffffffef] objc_msg_send_named :0x3d5af6 # 0x3d5af6 it is incorrect result, I expect 0xfffffff0 # And if I comment this line " if (!m) return nil;" # then test works properly $ a.exe -[MyObject print: 0xffffffef] -[obj print:0xffffffef] : 0xfffffff0 -[MyObject print: 0xffffffef] objc_msg_send_named :0xfffffff0 Thanks a lot. Aleksey ---------------------------------------------------------------------- >Comment By: Danny Smith (dannysmith) Date: 2002-05-29 11:57 Message: Logged In: YES user_id=11494 I've confirmed the bug. Thanks for the report and the testcase. I'm rebuilding gcc now to test for a posssible fix to the bug. Danny ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=561648&group_id=2435 |