aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/libgo/runtime/go-reflect-call.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/libgo/runtime/go-reflect-call.c')
-rw-r--r--gcc-4.8/libgo/runtime/go-reflect-call.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc-4.8/libgo/runtime/go-reflect-call.c b/gcc-4.8/libgo/runtime/go-reflect-call.c
index 5cf370798..12bd0d7c2 100644
--- a/gcc-4.8/libgo/runtime/go-reflect-call.c
+++ b/gcc-4.8/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 *));