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 Mon, Jan 25, 2016 at 10:47:10PM +0100, Michael Karcher wrote:
> Hello gcc developers,
> 
> as discussed in https://ghc.haskell.org/trac/ghc/ticket/11395 (and
> forwarded as PR c/69221), ghc generates non-compliant C code that is not
> compiled as intended on m68k. This is because its internal Cmm (a C--
> dialect) to C compiler needs to declare external functions (no varargs)
> without fixing the type. It currently uses "unspecified-function-type*
> function();" which is a quite good fit, because the argument list is
> still left open, but it fixes the return type to some pointer type.
> Before calling that function, the function address is put into a
> function pointer of the correct type and invoked via that pointer. This
> model currently works fine (possibly by accident) on all architectures
> ghc supports except m68k.

we have seen this problem come up plenty of times, so far it was always 
solved by repairing the offending program.

>From experience I would say that whatever ghc is trying to do can be done 
correctly and ghc should try that.


Richard

-- 
Name and OpenPGP keys available from pgp key servers


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