http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45878
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> 2010-10-04 09:25:18
UTC ---
hm, I made a very simple root object like this [omitting the cruft to declare
the types & routines for both NeXT and GNU runtimes].
----
@interface myRootObject {
@public
Class isa;
int var;
}
+ (id) initialize;
+(Class) class;
+ (id) alloc ;
- (id) init;
- (int) var;
@end
@implementation myRootObject
+initialize { return self;}
+(Class)class { return object_get_class(self);}
+ (id) alloc { return class_create_instance(self);}
- (id) init {return self;}
- (int) var {return var;}
@end
int main ()
{
myRootObject *r = [[myRootObject alloc] init];
r->var = 1;
return [r var];
}
----
All is OK until we hit the [r var] line - which fails with the gimple int !=
struct objc_class * error.
however, stepping through the code in build_objc_method_call() ... seems to
show that the cast is correctly installed.....
Breakpoint 4, build_objc_method_call (loc=33157, super_flag=0,
method_prototype=0x41aa7bd0, lookup_object=0x41abe16c, selector=0x41ababa0,
method_params=0x41abc360) at /GCC/gcc-live-trunk/gcc/objc/objc-act.c:6719
6719 t = build3 (OBJ_TYPE_REF, sender_cast, method, lookup_object,
size_zero_node);
(gdb) call debug_tree(sender_cast)
<pointer_type 0x41abac60
type <function_type 0x41abac00
type <integer_type 0x41a192a0 int asm_written public SI
size <integer_cst 0x41a05380 constant 32>
unit size <integer_cst 0x41a05120 constant 4>
align 32 symtab 1101764720 alias set -1 canonical type 0x41a192a0
precision 32 min <integer_cst 0x41a05320 -2147483648> max <integer_cst
0x41a05340 2147483647>
pointer_to_this <pointer_type 0x41a19c00>>
QI
size <integer_cst 0x41a051c0 constant 8>
unit size <integer_cst 0x41a051e0 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x41abac00
arg-types <tree_list 0x41abc318 value <pointer_type 0x41aa2780 id>
chain <tree_list 0x41abc330 value <pointer_type 0x41aa2960>
chain <tree_list 0x41a15090 value <void_type 0x41a19840
void>>>>
pointer_to_this <pointer_type 0x41abac60>>
unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
align 32 symtab 0 alias set -1 canonical type 0x41abac60>
(gdb) call debug_tree(method)
<addr_expr 0x41abe188
type <pointer_type 0x41abaa80
type <function_type 0x41aa2cc0 type <pointer_type 0x41aa2780 id>
QI
size <integer_cst 0x41a051c0 constant 8>
unit size <integer_cst 0x41a051e0 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x41aa2cc0
arg-types <tree_list 0x41aa40a8 value <pointer_type 0x41aa2780 id>
chain <tree_list 0x41aa40c0 value <pointer_type 0x41aa2960>>>
pointer_to_this <pointer_type 0x41abaa80>>
unsigned SI
size <integer_cst 0x41a05380 constant 32>
unit size <integer_cst 0x41a05120 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x41abaa80>
constant
arg 0 <function_decl 0x41aa3b80 objc_msgSend type <function_type
0x41aa2cc0>
public external decl_6 QI file <built-in> line 0 col 0 align 8>
../tests/root-simple.m:93:3>
(gdb) call debug_tree(lookup_object)
<save_expr 0x41abe16c
type <pointer_type 0x41aa2780 id
type <record_type 0x41aa26c0 objc_object VOID
align 8 symtab 0 alias set -1 canonical type 0x41aa26c0
pointer_to_this <pointer_type 0x41aa2780 id> chain <type_decl
0x41a20e58 D.1555>>
unsigned SI
size <integer_cst 0x41a05380 constant 32>
unit size <integer_cst 0x41a05120 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x41aa2780
pointer_to_this <pointer_type 0x41aa9600>>
side-effects
arg 0 <nop_expr 0x41abe150 type <pointer_type 0x41aa2780 id>
arg 0 <var_decl 0x41aba8a0 r type <pointer_type 0x41aba420>
used unsigned SI file ../tests/root-simple.m line 90 col 17 size
<integer_cst 0x41a05380 32> unit size <integer_cst 0x41a05120 4>
align 32 context <function_decl 0x41abb180 main> initial <nop_expr
0x41abe0e0>>>>
(gdb) next
6720 return build_function_call (loc,
(gdb) call debug_tree(t)
<obj_type_ref 0x41a0f9b4
type <pointer_type 0x41abac60
type <function_type 0x41abac00 type <integer_type 0x41a192a0 int>
QI
size <integer_cst 0x41a051c0 constant 8>
unit size <integer_cst 0x41a051e0 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x41abac00
arg-types <tree_list 0x41abc318 value <pointer_type 0x41aa2780 id>
chain <tree_list 0x41abc330 value <pointer_type 0x41aa2960>
chain <tree_list 0x41a15090 value <void_type 0x41a19840
void>>>>
pointer_to_this <pointer_type 0x41abac60>>
unsigned SI
size <integer_cst 0x41a05380 constant 32>
unit size <integer_cst 0x41a05120 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x41abac60>
side-effects
arg 0 <addr_expr 0x41abe188
type <pointer_type 0x41abaa80 type <function_type 0x41aa2cc0>
unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
align 32 symtab 0 alias set -1 canonical type 0x41abaa80>
constant
arg 0 <function_decl 0x41aa3b80 objc_msgSend type <function_type
0x41aa2cc0>
public external decl_6 QI file <built-in> line 0 col 0 align 8>
../tests/root-simple.m:93:3>
arg 1 <save_expr 0x41abe16c
type <pointer_type 0x41aa2780 id type <record_type 0x41aa26c0
objc_object>
unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
align 32 symtab 0 alias set -1 canonical type 0x41aa2780
pointer_to_this <pointer_type 0x41aa9600>>
side-effects
arg 0 <nop_expr 0x41abe150 type <pointer_type 0x41aa2780 id>
arg 0 <var_decl 0x41aba8a0 r>>>
arg 2 <integer_cst 0x41a05140 type <integer_type 0x41a19000 long unsigned
int> constant 0>>
(gdb)
after the function build:
(gdb) call debug_tree(retval)
<call_expr 0x4141f580
type <integer_type 0x41a192a0 int asm_written public SI
size <integer_cst 0x41a05380 constant 32>
unit size <integer_cst 0x41a05120 constant 4>
align 32 symtab 1101764720 alias set -1 canonical type 0x41a192a0
precision 32 min <integer_cst 0x41a05320 -2147483648> max <integer_cst
0x41a05340 2147483647>
pointer_to_this <pointer_type 0x41a19c00>>
side-effects
fn <obj_type_ref 0x41a0f9b4
type <pointer_type 0x41abac60 type <function_type 0x41abac00>
unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
align 32 symtab 0 alias set -1 canonical type 0x41abac60>
side-effects
arg 0 <addr_expr 0x41abe188 type <pointer_type 0x41abaa80>
constant arg 0 <function_decl 0x41aa3b80 objc_msgSend>
../tests/root-simple.m:93:3>
arg 1 <save_expr 0x41abe16c type <pointer_type 0x41aa2780 id>
side-effects
arg 0 <nop_expr 0x41abe150 type <pointer_type 0x41aa2780 id>
arg 0 <var_decl 0x41aba8a0 r>>>
arg 2 <integer_cst 0x41a05140 constant 0>> arg 0 <save_expr 0x41abe16c>
arg 1 <var_decl 0x41ababa0 _OBJC_SELECTOR_REFERENCES_2
type <pointer_type 0x41aa2960 type <record_type 0x41aa2900
objc_selector>
unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
align 32 symtab 0 alias set -1 canonical type 0x41aa2960>
static unsigned ignored SI file ../tests/root-simple.m line 93 col 3
size <integer_cst 0x41a05380 32> unit size <integer_cst 0x41a05120 4>
align 32 initial <error_mark 0x41a0b890>>
../tests/root-simple.m:93:3>
(gdb) call debug_tree(0x41abac00)
<function_type 0x41abac00
type <integer_type 0x41a192a0 int asm_written public SI
size <integer_cst 0x41a05380 constant 32>
unit size <integer_cst 0x41a05120 constant 4>
align 32 symtab 1101764720 alias set -1 canonical type 0x41a192a0
precision 32 min <integer_cst 0x41a05320 -2147483648> max <integer_cst
0x41a05340 2147483647>
pointer_to_this <pointer_type 0x41a19c00>>
QI
size <integer_cst 0x41a051c0 type <integer_type 0x41a19060 bit_size_type>
constant 8>
unit size <integer_cst 0x41a051e0 type <integer_type 0x41a19000 long
unsigned int> constant 1>
align 8 symtab 0 alias set -1 canonical type 0x41abac00
arg-types <tree_list 0x41abc318
value <pointer_type 0x41aa2780 id type <record_type 0x41aa26c0
objc_object>
unsigned SI size <integer_cst 0x41a05380 32> unit size <integer_cst
0x41a05120 4>
align 32 symtab 0 alias set -1 canonical type 0x41aa2780
pointer_to_this <pointer_type 0x41aa9600>>
chain <tree_list 0x41abc330 value <pointer_type 0x41aa2960>
chain <tree_list 0x41a15090 value <void_type 0x41a19840 void>>>>
pointer_to_this <pointer_type 0x41abac60>>