[PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner
Ian Lance Taylor
iant@google.com
Sat Sep 20 22:04:00 GMT 2014
On Sat, Sep 20, 2014 at 3:04 AM, Anthony Green <green@moxielogic.com> wrote:
>
>> Attached patch fixes libgo reflect test failure with libffi closures.
>> The gccgo compiler started to use FFI closures recently; the compiler
>> passes ffi_type_void for structures with zero members.
>
> Why not just pass an FFI_TYPE_STRUCT with zero members?
Because when an empty struct is used as a return type libffi returns
a failure from ffi_prep_cif_core:
/* Initialize the return type if necessary */
if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK))
return FFI_BAD_TYPEDEF;
This is because initialize_aggregate fails:
if (UNLIKELY(arg == NULL || arg->elements == NULL))
return FFI_BAD_TYPEDEF;
I haven't looked farther.
Ian
More information about the Libffi-discuss
mailing list