Bug 21229 - LibFFI can't handle Longs
Summary: LibFFI can't handle Longs
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libffi (show other bugs)
Version: 3.3.5
: P2 normal
Target Milestone: ---
Assignee: Anthony Green
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-26 00:47 UTC by Pupeno
Modified: 2007-08-24 19:34 UTC (History)
2 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-09-30 13:37:01


Attachments
Test program for FFI. (369 bytes, text/plain)
2005-04-26 00:49 UTC, Pupeno
Details
Test library for ffi. (144 bytes, text/plain)
2005-04-26 00:49 UTC, Pupeno
Details
A makefile to easy compilation (and show how I am compiling it). (167 bytes, text/plain)
2005-04-26 00:50 UTC, Pupeno
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pupeno 2005-04-26 00:47:59 UTC
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 :( ).
Comment 1 Pupeno 2005-04-26 00:49:13 UTC
Created attachment 8740 [details]
Test program for FFI.
Comment 2 Pupeno 2005-04-26 00:49:54 UTC
Created attachment 8741 [details]
Test library for ffi.
Comment 3 Pupeno 2005-04-26 00:50:27 UTC
Created attachment 8742 [details]
A makefile to easy compilation (and show how I am compiling it).
Comment 4 Pupeno 2005-04-26 00:51:26 UTC
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) 
 
Comment 5 Andrew Pinski 2005-04-26 01:52:40 UTC
This works fine for me on ppc-darwin with the mainline GCC.
Comment 6 Andrew Pinski 2005-04-26 01:55:38 UTC
But it does not on i686-pc-linux-gnu confirmed.
Comment 7 Anthony Green 2005-11-06 17:51:28 UTC
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?
Comment 8 Pupeno 2005-11-09 00:02:23 UTC
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.
Comment 9 David Daney 2007-08-24 19:34:47 UTC
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.