summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-13 20:30:10 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-13 20:30:10 +0000
commit252a0b874fc8b9ee248159fa6e951b07410027e3 (patch)
tree42d93daff79578d66b6660c2821be75d45c938a4 /gcc
parent382597e4e1587e7de04f81ba9903811a8a93d640 (diff)
downloadgcc-252a0b874fc8b9ee248159fa6e951b07410027e3.tar.gz
2010-10-13 Richard Guenther <rguenther@suse.de>
PR objc/45878 * gimple-fold.c (gimple_fold_obj_type_ref): Leave OBJ_TYPE_REFs alone if there are no virtual methods. * objc.dg/pr45878.m: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimple-fold.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/objc.dg/pr45878.m28
4 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1fbd8815346..296926bb41f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-10-13 Richard Guenther <rguenther@suse.de>
+
+ PR objc/45878
+ * gimple-fold.c (gimple_fold_obj_type_ref): Leave OBJ_TYPE_REFs
+ alone if there are no virtual methods.
+
2010-10-13 Richard Henderson <rth@redhat.com>
* expr.c (build_personality_function): Take parameter LANG instead
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index ce232e609e1..697e3643528 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1524,9 +1524,9 @@ gimple_fold_obj_type_ref (tree ref, tree known_type)
if (binfo)
{
HOST_WIDE_INT token = tree_low_cst (OBJ_TYPE_REF_TOKEN (ref), 1);
- /* If there is no virtual methods fold this to an indirect call. */
+ /* If there is no virtual methods leave the OBJ_TYPE_REF alone. */
if (!BINFO_VIRTUALS (binfo))
- return OBJ_TYPE_REF_EXPR (ref);
+ return NULL_TREE;
return gimple_fold_obj_type_ref_known_binfo (token, binfo);
}
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d367981948c..3ed9a37afce 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-13 Richard Guenther <rguenther@suse.de>
+
+ PR objc/45878
+ * objc.dg/pr45878.m: New testcase.
+
2010-10-13 Kai Tietz <kai.tietz@onevision.com>
* gcc.dg/format/dfp-scanf-1.c: Disable for *-*-mingw* targets.
diff --git a/gcc/testsuite/objc.dg/pr45878.m b/gcc/testsuite/objc.dg/pr45878.m
new file mode 100644
index 00000000000..0c6b908feb0
--- /dev/null
+++ b/gcc/testsuite/objc.dg/pr45878.m
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fexceptions" } */
+
+typedef struct objc_object { Class class_pointer; } *id;
+typedef unsigned char BOOL;
+
+@interface Object
+{
+ Class isa;
+}
+- (BOOL)isEqual:anObject;
+@end
+
+@interface NXConstantString: Object
+{
+ char *c_string;
+ unsigned int len;
+}
+@end
+
+void function (void)
+{
+ if ([@"strings" isEqual: (id)0])
+ {
+ ;
+ }
+}
+