libgo patch committed: FFI promotes result types

Ian Lance Taylor iant@google.com
Sat Feb 11 08:16:00 GMT 2012


The FFI documentation doesn't mention it, but it turns out that the FFI
library promotes integer result types.  That is, if a function is
declared as returning short, FFI will actually store the result as an
int.  The code in libgo was getting away with not supporting this
because allocating one or two bytes would always permit storing four or
eight bytes, and because I was only testing on little-endian systems.
On big-endian systems this needs to be handled correctly.  This patch
does that.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Ran some but not all tests on
sparc-sun-solaris2.11.  Committed to mainline.

Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 2497 bytes
Desc: patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120211/e31af660/attachment.bin>


More information about the Gcc-patches mailing list