This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner
- From: Ian Lance Taylor <iant at google dot com>
- To: Anthony Green <green at moxielogic dot com>
- Cc: Uros Bizjak <ubizjak at gmail dot com>, "libffi-discuss at sourceware dot org" <libffi-discuss at sourceware dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Sat, 20 Sep 2014 15:04:04 -0700
- Subject: Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4ZDJxVU+v7fLOd3jW73LUn0LEcBdwHZpdre4hcGLa6wyw at mail dot gmail dot com> <8738bmip4u dot fsf at moxielogic dot com>
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