summaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-19 02:30:03 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-19 02:30:03 +0000
commit723f3d2c0e968a337e990bdcacf57fa5650750f6 (patch)
tree16f6d5875810d941d00dcc7096e6e77ae76ce1bf /libgo/runtime
parenta3db0683aede5b937aa7a76bb4a0f547deed7144 (diff)
downloadgcc-723f3d2c0e968a337e990bdcacf57fa5650750f6.tar.gz
reflect: Handle calls to functions that take or return empty structs
Fixes issue 6761 This simple change seems to work fine, slightly to my surprise. This includes the tests I submitted to the main Go repository at https://codereview.appspot.com/26570046 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205001 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/go-reflect-call.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libgo/runtime/go-reflect-call.c b/libgo/runtime/go-reflect-call.c
index 0fed68a50e7..07b99d7433b 100644
--- a/libgo/runtime/go-reflect-call.c
+++ b/libgo/runtime/go-reflect-call.c
@@ -98,9 +98,12 @@ go_struct_to_ffi (const struct __go_struct_type *descriptor)
const struct __go_struct_field *fields;
int i;
+ field_count = descriptor->__fields.__count;
+ if (field_count == 0) {
+ return &ffi_type_void;
+ }
ret = (ffi_type *) __go_alloc (sizeof (ffi_type));
ret->type = FFI_TYPE_STRUCT;
- field_count = descriptor->__fields.__count;
fields = (const struct __go_struct_field *) descriptor->__fields.__values;
ret->elements = (ffi_type **) __go_alloc ((field_count + 1)
* sizeof (ffi_type *));