This is the mail archive of the gcc@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: RFC: Support non-standard extension (call via casted function pointer)


On 01/28/2016 03:11 AM, Florian Weimer wrote:
On 01/27/2016 04:17 PM, Richard Biener wrote:

We are trying to support

t.c
---
void *foo();

int bar()
{
   return ((int (*)())foo) ();
}

t2.c
-----
int foo () { return 0; }

thus doing a direct call to a function with a (wrong) prototype via a function
pointer cast to the correct type and having a matching implementation of
that function elsewhere.

I suspect Ada needs something like this already.  I expect the following
to work (although it is quite hideous).
Yes. I'm pretty sure there's a BZ to this effect already in the gcc-bugs database.

I know someone (probably Andreas) with some work was able to get GCC working with Ada. However, they didn't push to get all those changes upstreamed.

It's one of the reasons why I think we should at least explore a more a solution within GCC iteslf.

Jeff


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