From 609db2fbe41a56c1a8cd5653d248f08b88ea803f Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 25 Jul 2015 12:42:04 -0700 Subject: [PATCH 1/2] Test case from Issue #70 --- testsuite/libffi.call/align_mixed.c | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 testsuite/libffi.call/align_mixed.c diff --git a/testsuite/libffi.call/align_mixed.c b/testsuite/libffi.call/align_mixed.c new file mode 100644 index 00000000..5d4959ce --- /dev/null +++ b/testsuite/libffi.call/align_mixed.c @@ -0,0 +1,46 @@ +/* Area: ffi_call + Purpose: Check for proper argument alignment. + Limitations: none. + PR: none. + Originator: (from many_win32.c) */ + +/* { dg-do run } */ + +#include "ffitest.h" + +static float ABI_ATTR align_arguments(int i1, + double f2, + int i3, + double f4) +{ + return i1+f2+i3+f4; +} + +int main(void) +{ + ffi_cif cif; + ffi_type *args[4] = { + &ffi_type_sint, + &ffi_type_double, + &ffi_type_sint, + &ffi_type_double + }; + double fa[2] = {1,2}; + int ia[2] = {1,2}; + void *values[4] = {&ia[0], &fa[0], &ia[1], &fa[1]}; + float f, ff; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, ABI_NUM, 4, + &ffi_type_float, args) == FFI_OK); + + ff = align_arguments(ia[0], fa[0], ia[1], fa[1]); + + ffi_call(&cif, FFI_FN(align_arguments), &f, values); + + if (f == ff) + printf("align arguments tests ok!\n"); + else + CHECK(0); + exit(0); +} From 4cdedc279f96aefda24277184594c0ddd56d3402 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 25 Jul 2015 14:29:15 -0700 Subject: [PATCH 2/2] Tidy call.exp test collection Commit c952a92e20aa6013d8202d0b3fa1d87838c83054 moved all of the complex tests to libffi.complex, but failed to remove the anti-globbing from libffi.call. --- testsuite/libffi.call/call.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/libffi.call/call.exp b/testsuite/libffi.call/call.exp index 46fb1ebb..bc2bdc3e 100644 --- a/testsuite/libffi.call/call.exp +++ b/testsuite/libffi.call/call.exp @@ -19,7 +19,7 @@ libffi-init global srcdir subdir -set tlist [lsearch -inline -all -not -glob [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] *complex*] +set tlist [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] run-many-tests $tlist ""