diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-17 20:24:00 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-17 20:24:00 +0000 |
commit | 033425d0ed0092748fc919e5c40dc47421dcdd89 (patch) | |
tree | 7ff26ef5001f70214c75d5fe6546930b57a52d4c /libgo/runtime/go-reflect-call.c | |
parent | 99a28ee8c18fd1f452c002f0548c54eb0a7be817 (diff) | |
download | gcc-033425d0ed0092748fc919e5c40dc47421dcdd89.zip gcc-033425d0ed0092748fc919e5c40dc47421dcdd89.tar.gz gcc-033425d0ed0092748fc919e5c40dc47421dcdd89.tar.bz2 |
re PR go/91781 (r275691 breaks go test "reflect")
PR go/91781
reflect: promote integer closure return to full word
The libffi library expects an integer return type to be promoted to a
full word. Implement that when returning from a closure written in Go.
This only matters on big-endian systems when returning an integer smaller
than the pointer size, which is why we didn't notice it until now.
Fixes https://gcc.gnu.org/PR91781.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/195858
From-SVN: r275813
Diffstat (limited to 'libgo/runtime/go-reflect-call.c')
-rw-r--r-- | libgo/runtime/go-reflect-call.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libgo/runtime/go-reflect-call.c b/libgo/runtime/go-reflect-call.c index ffae903..4d887eb 100644 --- a/libgo/runtime/go-reflect-call.c +++ b/libgo/runtime/go-reflect-call.c @@ -44,8 +44,8 @@ go_results_size (const struct functype *func) types = (const struct _type **) func->out.__values; - /* A single integer return value is always promoted to a full - word. */ + /* A single integer return value is always promoted to a full word. + There is similar code below and in libgo/go/reflect/makefunc_ffi.go.*/ if (count == 1) { switch (types[0]->kind & kindMask) @@ -57,8 +57,6 @@ go_results_size (const struct functype *func) case kindUint8: case kindUint16: case kindUint32: - case kindInt: - case kindUint: return sizeof (ffi_arg); default: @@ -108,8 +106,8 @@ go_set_results (const struct functype *func, unsigned char *call_result, types = (const struct _type **) func->out.__values; - /* A single integer return value is always promoted to a full - word. */ + /* A single integer return value is always promoted to a full word. + There is similar code above and in libgo/go/reflect/makefunc_ffi.go.*/ if (count == 1) { switch (types[0]->kind & kindMask) @@ -121,8 +119,6 @@ go_set_results (const struct functype *func, unsigned char *call_result, case kindUint8: case kindUint16: case kindUint32: - case kindInt: - case kindUint: { union { |