diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-01 23:29:59 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-12-01 23:29:59 +0000 |
commit | c34d298cb3d741391b5c810c8999b7e0d11fa141 (patch) | |
tree | 13d311306a2e450cead72959b52908f3a1874875 | |
parent | 1a821ba124bfc62da58f60895bfe098e8bc6262f (diff) | |
download | gcc-c34d298cb3d741391b5c810c8999b7e0d11fa141.tar.gz |
PR 11433
gcc/testsuite:
* objc.dg/proto-lossage-3.m: New test.
libobjc:
* Protocol.m (descriptionForInstanceMethod): Don't dereference
instance_methods if it's NULL.
(descriptionForClassMethod): Likewise for class_methods.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74137 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/testsuite/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/proto-lossage-3.m | 25 | ||||
-rw-r--r-- | libobjc/ChangeLog | 15 | ||||
-rw-r--r-- | libobjc/Protocol.m | 22 |
4 files changed, 59 insertions, 20 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 90f516714d5..a880222b188 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2003-12-01 Zack Weinberg <zack@codesourcery.com> + + PR 11433 + * objc.dg/proto-lossage-3.m: New test. + 2003-12-01 Roger Sayle <roger@eyesopen.com> PR optimization/12628 @@ -114,8 +119,8 @@ 2003-11-14 Giovanni Bajo <giovannibajo@libero.it> - PR c++/2294 - * g++.dg/lookup/using9.c: New test. + PR c++/2294 + * g++.dg/lookup/using9.c: New test. 2003-11-14 Mark Mitchell <mark@codesourcery.com> @@ -131,15 +136,15 @@ 2003-11-14 Giovanni Bajo <giovannibajo@libero.it> - PR c++/2094 - * g++.dg/template/ptrmem7.C: New test. + PR c++/2094 + * g++.dg/template/ptrmem7.C: New test. 2003-11-13 Andrew Pinski <apinski@apple.com> * gcc.c-torture/compile/20031113-1.c: New test. 2003-11-13 Mark Mitchell <mark@codesourcery.com> - Kean Johnston <jkj@sco.com> + Kean Johnston <jkj@sco.com> PR c/13029 * gcc.dg/unused-4.c: Update. @@ -650,7 +655,7 @@ 2003-09-29 Richard Henderson <rth@redhat.com> - * g++.dg/init/array10.C: Add dg-options. + * g++.dg/init/array10.C: Add dg-options. 2003-09-29 Eric Botcazou <ebotcazou@libertysurf.fr> diff --git a/gcc/testsuite/objc.dg/proto-lossage-3.m b/gcc/testsuite/objc.dg/proto-lossage-3.m new file mode 100644 index 00000000000..512a59ee6dc --- /dev/null +++ b/gcc/testsuite/objc.dg/proto-lossage-3.m @@ -0,0 +1,25 @@ +/* Crash due to descriptionFor(Instance|Class)Method applied to + a protocol with no instance/class methods respectively. + Problem report and original fix by richard@brainstorm.co.uk. */ +/* { dg-do run } */ +#include <objc/objc.h> +#include <objc/Object.h> +#include <objc/Protocol.h> + +@protocol NoInstanceMethods ++ testMethod; +@end + +@protocol NoClassMethods +- testMethod; +@end + +int +main() +{ +[@protocol(NoInstanceMethods) descriptionForInstanceMethod: @selector(name)]; +[@protocol(NoInstanceMethods) descriptionForClassMethod: @selector(name)]; +[@protocol(NoClassMethods) descriptionForInstanceMethod: @selector(name)]; +[@protocol(NoClassMethods) descriptionForClassMethod: @selector(name)]; +return 0; +} diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 3032e7a40dd..f900eafd570 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,10 @@ +2003-12-01 Zack Weinberg <zack@codesourcery.com> + + PR 11433 + * Protocol.m (descriptionForInstanceMethod): Don't dereference + instance_methods if it's NULL. + (descriptionForClassMethod): Likewise for class_methods. + 2003-10-24 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * Makefile.in (runtime-info.h): Remove -Wp. @@ -36,14 +43,14 @@ Thu Jul 10 10:27:43 2003 Nicola Pero <n.pero@mi.flashnet.it> (objc_msg_lookup): Similar fixes. (__objc_init_install_dtable): Lock the runtime before checking if the table is installed. - + 2003-05-23 Nathanael Nerode <neroden@gcc.gnu.org> * hash.c, init.c, libobjc.def, libobjc_entry.c, linking.m, makefile.dos, misc.c, nil_method.c, objects.c, sarray.c, selector.c, sendmsg.c, thr-dce.c, thr-decosf1.c, thr-irix.c, thr-mach.c, thr-objc.c, thr-os2.c, thr-posix.c, thr-pthreads.c, - thr-rtems.c, thr-single.c, thr-solaris.c, thr-vxworks.c, + thr-rtems.c, thr-single.c, thr-solaris.c, thr-vxworks.c, thr-win32.c, thr.c: Replace "GNU CC" with "GCC". * Makefile.in, NXConstStr.m, Object.m, Protocol.m, archive.c, class.c, encoding.c, gc.c, objc/NXConstStr.h, objc/Object.h, @@ -52,14 +59,14 @@ Thu Jul 10 10:27:43 2003 Nicola Pero <n.pero@mi.flashnet.it> objc/thr.h, objc/typedstream.h: Replace "GNU CC" with "GCC". Tue May 13 14:56:03 2003 Richard Frith-Macdonald <rfm@gnu.org> - Nicola Pero <n.pero@mi.flashnet.it> + Nicola Pero <n.pero@mi.flashnet.it> libobjc/10742 * init.c (class_superclass_of_class): New function. (create_tree_of_subclasses_inherited_from): Use it. (__objc_tree_insert_class): Likewise. (class_is_subclass_of_class): Likewise. - + 2003-04-11 David Chad <davidc@freebsd.org> Loren J. Rittle <ljrittle@acm.org> diff --git a/libobjc/Protocol.m b/libobjc/Protocol.m index 8191dc21535..06a25acabbe 100644 --- a/libobjc/Protocol.m +++ b/libobjc/Protocol.m @@ -80,11 +80,12 @@ struct objc_method_description_list { const char* name = sel_get_name (aSel); struct objc_method_description *result; - for (i = 0; i < instance_methods->count; i++) - { - if (!strcmp ((char*)instance_methods->list[i].name, name)) - return &(instance_methods->list[i]); - } + if (instance_methods) + for (i = 0; i < instance_methods->count; i++) + { + if (!strcmp ((char*)instance_methods->list[i].name, name)) + return &(instance_methods->list[i]); + } for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) { @@ -107,11 +108,12 @@ struct objc_method_description_list { const char* name = sel_get_name (aSel); struct objc_method_description *result; - for (i = 0; i < class_methods->count; i++) - { - if (!strcmp ((char*)class_methods->list[i].name, name)) - return &(class_methods->list[i]); - } + if (class_methods) + for (i = 0; i < class_methods->count; i++) + { + if (!strcmp ((char*)class_methods->list[i].name, name)) + return &(class_methods->list[i]); + } for (proto_list = protocol_list; proto_list; proto_list = proto_list->next) { |