aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2003-12-01 23:29:59 +0000
committerZack Weinberg <zack@gcc.gnu.org>2003-12-01 23:29:59 +0000
commit75d3baee1823eb2211f58f8f3e0e718e4f128f08 (patch)
tree13d311306a2e450cead72959b52908f3a1874875 /gcc
parentbb9cfd00626b99a5d7cd770c91093ea27a907f84 (diff)
downloadgcc-75d3baee1823eb2211f58f8f3e0e718e4f128f08.zip
gcc-75d3baee1823eb2211f58f8f3e0e718e4f128f08.tar.gz
gcc-75d3baee1823eb2211f58f8f3e0e718e4f128f08.tar.bz2
re PR libobjc/11433 (Crash due to dereferencing null pointer when querying protocol)
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. From-SVN: r74137
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog17
-rw-r--r--gcc/testsuite/objc.dg/proto-lossage-3.m25
2 files changed, 36 insertions, 6 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 90f5167..a880222 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 0000000..512a59e
--- /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;
+}