This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Invalid libffi testcase?
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: Eric Botcazou <ebotcazou at libertysurf dot fr>
- Cc: Andreas Tobler <andreast at gcc dot gnu dot org>, gcc at gcc dot gnu dot org
- Date: Sat, 24 Jan 2004 16:13:48 +0100
- Subject: Re: Invalid libffi testcase?
- References: <200401241537.55120.ebotcazou@libertysurf.fr>
Hi Eric,
Eric Botcazou wrote:
The testcase libffi.call/pyobj-tc.c fails on SPARC64 at runtime because the
program attemps to store a word to a non word-aligned address. More
specifically, it dies when storing the result value of
I took this test case as original as possible from a bug reporter.
The bug itself was on darwin afair.
And I did not bother, sorry!
ffi_call(&cif, FFI_FN(doit), &result, values);
to 'result', which is defined by
int result;
Now the README file contains this paragraph:
RVALUE is a pointer to a chunk of memory that is to hold the
result of the function call. Currently, it must be
at least one word in size (except for the n32 version
under Irix 6.x, which must be a pointer to an 8 byte
aligned value (a long long). It must also be at least
word aligned (depending on the return type, and the
system's alignment requirements). If RTYPE is
&ffi_type_void, this is ignored. If RVALUE is NULL,
the return value is discarded.
Clearly, on LP64 platforms, the testcase doesn't fulfil the requirements
listed in the "manual".
Ok, let's fix it.
Index: pyobjc-tc.c
===================================================================
RCS file: /cvs/gcc/gcc/libffi/testsuite/libffi.call/pyobjc-tc.c,v
retrieving revision 1.2
diff -u -r1.2 pyobjc-tc.c
--- pyobjc-tc.c 19 Sep 2003 19:21:53 -0000 1.2
+++ pyobjc-tc.c 24 Jan 2004 15:10:52 -0000
@@ -93,7 +93,7 @@
int o = 0;
int l = 42;
char* m = "myMethod";
- int result;
+ ffi_arg result;
values[0] = &o;
values[1] = &m;
I will commit asap, ok ?
Andreas