re PR objc/45878 (Can't compile even a trivial ObjC program with -fexceptions -O2)

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.

From-SVN: r165435
This commit is contained in:
Richard Guenther 2010-10-13 20:30:10 +00:00 committed by Richard Biener
parent bde8a146a6
commit 0d8485e009
4 changed files with 41 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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])
{
;
}
}