This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PROPOSED PATCH: Robustify cp_fold_obj_type_ref() for ObjC++ use



On Sep 20, 2004, at 10:40 PM, Mark Mitchell wrote:


Ziemowit Laski wrote:

For some reason, RTH introduced OBJ_TYPE_REF nodes for dispatching ObjC/ObjC++ method
calls. In ObjC, this just falls through to the surrounding CALL_EXPR, but in ObjC++
it trips over cp_fold_obj_type_ref() since ObjC classes do not actually have any
virtual member functions. The change below is the easiest way to get things going
again. Would that be OK (with ChangeLog entry, of course), or should redirect this
to an ObjC++-specific lang hook? Or perhaps revert the use of OBJ_TYPE_REF for
ObjC/ObjC++ methods altogether (as I honestly don't know what it is trying to accomplish)?


Please advise,

It looks like you're not only getting OBJ_TYPE_REF nodes -- you're getting OBJ_TYPE_REF nodes that indicate that you're using a virtual function. (That's the OBJ_TYPE_REF_TOKEN.) Either the Objective-C and C++ front ends disagree about what OBJ_TYPE_REF_TOKEN means, or you shouldn't be building an OBJ_TYPE_REF at all in objc-act.c. My guess is the latter.

No, the Objective-C front-end is correct in creating a OBJ_TYPE_REF node as it is a virtual call (not like C++ but still a virtual call). If we make OBJ_TYPE_REF_TOKEN a null then we get a crash in cp_fold_obj_type_ref, anyways.

Basically in the C++ front-end we are assuming that BINFO_VIRTUALS
is non-null which is not true for Objective-C types which can
be located in OBJ_TYPE_REF so the bug is really in
cp_fold_obj_type_ref and should be fixed in a way which Zem proposed
either by the patch or by a hook.

Thanks,
Andrew Pinski
Someone who would like to see the Objective-C++ patches just approved
instead of being brutalized unlike optimization patches which you
(Mark) basically approved without any or little comment.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]