This is the mail archive of the
mailing list for the GCC project.
Re: Why does casting a function generate a run-time abort?
On Fri, Jun 18, 2004 at 02:13:11PM -0700, Ziemowit Laski wrote:
> Yes, I think that what you suggest could work, albeit at the cost of
> having to add additional machinery to GIMPLE.
Not so much as you'd think, I'll warrent. In addition, you may be
able to devirtualize some calls entirely.
> extern foo_id objc_msgSend(foo_id, char *, blort, blort);
> obj0 = objc_msgSend (obj0, "foo message", foo, bar);
> extern foo_id __objc_msgSend_local_nnnn(foo_id, char *, blort,
> blort) asm("objc_msgSend");
> obj0 = __objc_msgSend_local_nnnn (obj0, "foo message", foo, bar);
<CALL_EXPR <METHOD_EXPR obj0 message> (obj0, "message", foo, bar)>
perhaps rendered in the pretty printer as
obj0 = METHOD<obj0, message>(obj0, "message", foo, bar)
wherein METHOD_EXPR has type "foo_id ()(foo_id, const char *, blort, blort)"
and expands (during rtl) to objc_msgSend.
I think you definitely want to NOT think about things you could sort-of
represent with C.
I'd want to think about how this might be used in C++ and Java before
settling the semantics of METHOD_EXPR, but I think something like this
could work well.