This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Patch] libffi: Fix broken return_ul.c test.
- From: David Daney <ddaney at avtrex dot com>
- To: GCJ-patches <java-patches at gcc dot gnu dot org>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: andreast at gcc dot gnu dot org
- Date: Wed, 01 Aug 2007 01:19:21 -0700
- Subject: [Patch] libffi: Fix broken return_ul.c test.
The return_ul.c test is failing for mips64 n32 ABI. The problem is that
the return value location was too small and was overflowing into
adjacent memory.
According to the libffi README, return values must be at least as large
as ffi_arg, so that is what I used.
Tested on x86_64-pc-linux-gnu and mips64-linux-gnu.
OK to commit?
2007-08-01 David Daney <ddaney@avtrex.com>
* testsuite/libffi.call/return_ul.c (main): Define return type as
ffi_arg. Use proper printf conversion specifier.
Index: testsuite/libffi.call/return_ul.c
===================================================================
--- testsuite/libffi.call/return_ul.c (revision 127010)
+++ testsuite/libffi.call/return_ul.c (working copy)
@@ -16,7 +16,7 @@ int main (void)
ffi_cif cif;
ffi_type *args[MAX_ARGS];
void *values[MAX_ARGS];
- unsigned long res;
+ ffi_arg res;
unsigned long ul1, ul2;
args[0] = &ffi_type_ulong;
@@ -31,7 +31,7 @@ int main (void)
ul2 = 1073741824L;
ffi_call(&cif, FFI_FN(return_ul), &res, values);
- printf("res: %ld, %ld\n", res, ul1 + ul2);
+ printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2);
/* { dg-output "res: 2147483647, 2147483647" } */
exit(0);