I've had troubles in the FFI module I'm building when dealing with (unsigned) longs, what happens is that the second unsigned long argument never reached the function I'm calling with ffi_call. I've built a small test (attached) to show this particular problem (in the hope that the problem would disappear, but that didn't happen). I've checked and re-checked how I pass the arguments to ffi_call, I couldn't find anything wrong (debugging libffi internals is not easy :( ).
Created attachment 8740 [details] Test program for FFI.
Created attachment 8741 [details] Test library for ffi.
Created attachment 8742 [details] A makefile to easy compilation (and show how I am compiling it).
I forgot to mention my gcc version (libffi from the same version of gcc): Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/specs Configured with: /var/tmp/portage/gcc-3.3.5.20050130-r1/work/gcc-3.3.5/configure --enable-version-specific-runtime-libs --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3.5-20050130 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3.5-20050130/info --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/include/g++-v3 --host=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --enable-java-awt=gtk --enable-languages=c,c++,objc,java,f77 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 3.3.5-20050130 (Gentoo Linux 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
This works fine for me on ppc-darwin with the mainline GCC.
But it does not on i686-pc-linux-gnu confirmed.
I'm unable to reproduce this with GCC 4.0.1 (x86 Linux). Could you please try a more recent compiler? If you are able to reproduce, could you please submit your example in the form of a test case for the libffi testsuite?
I am now running 4.0.2 20050808 (prerelease) and I can't reproduce it either. Whatever it was seems to be solved. Would you still be interested on the unit tests ? if so, could you point me to where I should start with it ? Thanks.
Currently both libffi.call/return_sl.c and libffi.call/return_ul.c pass. These cover all the cases in the ffitarget.c attached to the bug.