[cfe-dev] Fixing super lookup in class methods (GNU ObjC runtime)

David Chisnall csdavec at swansea.ac.uk
Sun Apr 19 05:44:39 PDT 2009


On 19 Apr 2009, at 02:34, Chris Lattner wrote:

> On Apr 18, 2009, at 4:12 PM, Chris Lattner wrote:
>
>>
>> On Apr 17, 2009, at 11:57 AM, David Chisnall wrote:
>>
>>> Hi,
>>>
>>> This patch fixes message sends to super in class methods for the
>>> GNU runtime (currently an instance method lookup is being  
>>> performed).
>>
>> Applied, thanks!
>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090413/015828.html
>>
>
> And reverted here.  This patch broke test/Coverage/codegen-gnu.m, one
> of the few tests we have for the gnu runtime codegen.  Please make
> sure that your patches pass basic sanity tests before submitting them,
> thanks.

This test failure is due to a bug in Sema.  Under the comment:

// Synthesize "typedef struct objc_object { Class isa; } *id;"

It is synthesising "typedef struct objc_object *id", i.e. synthesising  
id as a pointer to an opaque type.  This is incorrect (and I'm fairly  
sure a recent regression).  The original patch works correctly when id  
has a valid type (i.e. one which contains a pointer to the class),  
which is the case when any of the standard Objective-C headers is  
included and will be the case when this bug in sema is fixed.

I can work around this in CGObjCGNU by adding an explicit bitcast to a  
{ i8* }*, but that seems like an ugly hack.

David



More information about the cfe-dev mailing list