diff options
author | Richard Henderson <rth@redhat.com> | 2015-01-12 08:19:59 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2015-01-12 08:19:59 -0800 |
commit | b1760f7f915a36ee9b4636fb54719c9b3ae59356 (patch) | |
tree | 1a64d747b069bdebf651d856989dd40a54daf0cc /libffi/testsuite/libffi.call | |
parent | 62e22fcb7985349b93646b86351033e1fb09c46c (diff) | |
download | gcc-b1760f7f915a36ee9b4636fb54719c9b3ae59356.tar.gz |
Merge libffi to upstream commit c82cc159426d8d4402375fa1ae3f045b9cf82e16
From-SVN: r219477
Diffstat (limited to 'libffi/testsuite/libffi.call')
49 files changed, 401 insertions, 613 deletions
diff --git a/libffi/testsuite/libffi.call/call.exp b/libffi/testsuite/libffi.call/call.exp index 26acd813c01..46fb1ebb75f 100644 --- a/libffi/testsuite/libffi.call/call.exp +++ b/libffi/testsuite/libffi.call/call.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006, 2009, 2010, 2014 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,11 +19,9 @@ libffi-init global srcdir subdir -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" +set tlist [lsearch -inline -all -not -glob [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] *complex*] + +run-many-tests $tlist "" dg-finish diff --git a/libffi/testsuite/libffi.call/closure_stdcall.c b/libffi/testsuite/libffi.call/closure_simple.c index 1407f024c17..5a4e728d4a4 100644 --- a/libffi/testsuite/libffi.call/closure_stdcall.c +++ b/libffi/testsuite/libffi.call/closure_simple.c @@ -1,15 +1,14 @@ -/* Area: closure_call (stdcall convention) - Purpose: Check handling when caller expects stdcall callee +/* Area: closure_call + Purpose: Check simple closure handling with all ABIs Limitations: none. PR: none. Originator: <twalljava@dev.java.net> */ -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +/* { dg-do run } */ #include "ffitest.h" static void -closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) +closure_test(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(int *)args[0] + (int)(*(int *)args[1]) @@ -23,7 +22,7 @@ closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, } -typedef int (__stdcall *closure_test_type0)(int, int, int, int); +typedef int (ABI_ATTR *closure_test_type0)(int, int, int, int); int main (void) { @@ -32,9 +31,6 @@ int main (void) ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; - void* sp_pre; - void* sp_post; - char buf[1024]; cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = &ffi_type_uint; @@ -43,30 +39,17 @@ int main (void) cl_arg_types[4] = NULL; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 4, &ffi_type_sint, cl_arg_types) == FFI_OK); - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test, (void *) 3 /* userdata */, code) == FFI_OK); -#ifdef _MSC_VER - __asm { mov sp_pre, esp } -#else - asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); -#endif res = (*(closure_test_type0)code)(0, 1, 2, 3); -#ifdef _MSC_VER - __asm { mov sp_post, esp } -#else - asm volatile (" movl %%esp,%0" : "=g" (sp_post)); -#endif /* { dg-output "0 1 2 3: 9" } */ printf("res: %d\n",res); /* { dg-output "\nres: 9" } */ - sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); - printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); - /* { dg-output "\nstack pointer match" } */ exit(0); } diff --git a/libffi/testsuite/libffi.call/closure_thiscall.c b/libffi/testsuite/libffi.call/closure_thiscall.c deleted file mode 100644 index 0f93649ff75..00000000000 --- a/libffi/testsuite/libffi.call/closure_thiscall.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Area: closure_call (thiscall convention) - Purpose: Check handling when caller expects thiscall callee - Limitations: none. - PR: none. - Originator: <ktietz@redhat.com> */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ -#include "ffitest.h" - -static void -closure_test_thiscall(ffi_cif* cif __UNUSED__, void* resp, void** args, - void* userdata) -{ - *(ffi_arg*)resp = - (int)*(int *)args[0] + (int)(*(int *)args[1]) - + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) - + (int)(intptr_t)userdata; - - printf("%d %d %d %d: %d\n", - (int)*(int *)args[0], (int)(*(int *)args[1]), - (int)(*(int *)args[2]), (int)(*(int *)args[3]), - (int)*(ffi_arg *)resp); - -} - -typedef int (__thiscall *closure_test_type0)(int, int, int, int); - -int main (void) -{ - ffi_cif cif; - void *code; - ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); - ffi_type * cl_arg_types[17]; - int res; - void* sp_pre; - void* sp_post; - char buf[1024]; - - cl_arg_types[0] = &ffi_type_uint; - cl_arg_types[1] = &ffi_type_uint; - cl_arg_types[2] = &ffi_type_uint; - cl_arg_types[3] = &ffi_type_uint; - cl_arg_types[4] = NULL; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_THISCALL, 4, - &ffi_type_sint, cl_arg_types) == FFI_OK); - - CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_thiscall, - (void *) 3 /* userdata */, code) == FFI_OK); - -#ifdef _MSC_VER - __asm { mov sp_pre, esp } -#else - asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); -#endif - res = (*(closure_test_type0)code)(0, 1, 2, 3); -#ifdef _MSC_VER - __asm { mov sp_post, esp } -#else - asm volatile (" movl %%esp,%0" : "=g" (sp_post)); -#endif - /* { dg-output "0 1 2 3: 9" } */ - - printf("res: %d\n",res); - /* { dg-output "\nres: 9" } */ - - sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); - printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); - /* { dg-output "\nstack pointer match" } */ - exit(0); -} diff --git a/libffi/testsuite/libffi.call/cls_align_longdouble_split.c b/libffi/testsuite/libffi.call/cls_align_longdouble_split.c index 15f93654652..cc1c43b8ca4 100644 --- a/libffi/testsuite/libffi.call/cls_align_longdouble_split.c +++ b/libffi/testsuite/libffi.call/cls_align_longdouble_split.c @@ -4,10 +4,8 @@ PR: none. Originator: <hos@tamanegi.org> 20031203 */ -/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ -/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" diff --git a/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c b/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c index ca1c356cbe7..5d3bec07196 100644 --- a/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c +++ b/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c @@ -5,10 +5,8 @@ Originator: Blake Chaffin 6/18/2007 */ -/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ -/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" diff --git a/libffi/testsuite/libffi.call/cls_longdouble.c b/libffi/testsuite/libffi.call/cls_longdouble.c index e6bac1f8377..d24e72e4aed 100644 --- a/libffi/testsuite/libffi.call/cls_longdouble.c +++ b/libffi/testsuite/libffi.call/cls_longdouble.c @@ -4,10 +4,10 @@ PR: none. Originator: Blake Chaffin */ -/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ -/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ +/* This test is known to PASS on armv7l-unknown-linux-gnueabihf, so I have + remove the xfail for arm*-*-* below, until we know more. */ +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ -/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" diff --git a/libffi/testsuite/libffi.call/cls_many_mixed_args.c b/libffi/testsuite/libffi.call/cls_many_mixed_args.c new file mode 100644 index 00000000000..7fd6c8207ac --- /dev/null +++ b/libffi/testsuite/libffi.call/cls_many_mixed_args.c @@ -0,0 +1,70 @@ +/* Area: closure_call + Purpose: Check closures called with many args of mixed types + Limitations: none. + PR: none. + Originator: <david.schneider@picle.org> */ + +/* { dg-do run } */ +#include "ffitest.h" +#include <float.h> +#include <math.h> + +#define NARGS 16 + +static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + int i; + double r = 0; + double t; + for(i = 0; i < NARGS; i++) + { + if(i == 4 || i == 9 || i == 11 || i == 13 || i == 15) + { + t = *(long int *)args[i]; + CHECK(t == i+1); + } + else + { + t = *(double *)args[i]; + CHECK(fabs(t - ((i+1) * 0.1)) < FLT_EPSILON); + } + r += t; + } + *(double *)resp = r; +} +typedef double (*cls_ret_double)(double, double, double, double, long int, +double, double, double, double, long int, double, long int, double, long int, +double, long int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[NARGS]; + double res; + int i; + double expected = 64.9; + + for(i = 0; i < NARGS; i++) + { + if(i == 4 || i == 9 || i == 11 || i == 13 || i == 15) + cl_arg_types[i] = &ffi_type_slong; + else + cl_arg_types[i] = &ffi_type_double; + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, NARGS, + &ffi_type_double, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); + + res = (((cls_ret_double)code))(0.1, 0.2, 0.3, 0.4, 5, 0.6, 0.7, 0.8, 0.9, 10, + 1.1, 12, 1.3, 14, 1.5, 16); + if (fabs(res - expected) < FLT_EPSILON) + exit(0); + else + abort(); +} diff --git a/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c b/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c new file mode 100644 index 00000000000..62b0697ac01 --- /dev/null +++ b/libffi/testsuite/libffi.call/cls_many_mixed_float_double.c @@ -0,0 +1,55 @@ +/* Area: closure_call + Purpose: Check register allocation for closure calls with many float and double arguments + Limitations: none. + PR: none. + Originator: <david.schneider@picle.org> */ + +/* { dg-do run } */ +#include "ffitest.h" +#include <float.h> +#include <math.h> + +#define NARGS 16 + +static void cls_mixed_float_double_fn(ffi_cif* cif , void* ret, void** args, + void* userdata __UNUSED__) +{ + double r = 0; + unsigned int i; + double t; + for(i=0; i < cif->nargs; i++) + { + if(cif->arg_types[i] == &ffi_type_double) { + t = *(((double**)(args))[i]); + } else { + t = *(((float**)(args))[i]); + } + r += t; + } + *((double*)ret) = r; +} +typedef double (*cls_mixed)(double, float, double, double, double, double, double, float, float, double, float, float); + +int main (void) +{ + ffi_cif cif; + ffi_closure *closure; + void* code; + ffi_type *argtypes[12] = {&ffi_type_double, &ffi_type_float, &ffi_type_double, + &ffi_type_double, &ffi_type_double, &ffi_type_double, + &ffi_type_double, &ffi_type_float, &ffi_type_float, + &ffi_type_double, &ffi_type_float, &ffi_type_float}; + + + closure = ffi_closure_alloc(sizeof(ffi_closure), (void**)&code); + if(closure ==NULL) + abort(); + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 12, &ffi_type_double, argtypes) == FFI_OK); + CHECK(ffi_prep_closure_loc(closure, &cif, cls_mixed_float_double_fn, NULL, code) == FFI_OK); + double ret = ((cls_mixed)code)(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2); + ffi_closure_free(closure); + if(fabs(ret - 7.8) < FLT_EPSILON) + exit(0); + else + abort(); +} diff --git a/libffi/testsuite/libffi.call/cls_pointer.c b/libffi/testsuite/libffi.call/cls_pointer.c index cf0399343a4..d82a87a71b6 100644 --- a/libffi/testsuite/libffi.call/cls_pointer.c +++ b/libffi/testsuite/libffi.call/cls_pointer.c @@ -35,7 +35,7 @@ int main (void) void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); diff --git a/libffi/testsuite/libffi.call/cls_pointer_stack.c b/libffi/testsuite/libffi.call/cls_pointer_stack.c index e31139e428f..1f1d9157b9d 100644 --- a/libffi/testsuite/libffi.call/cls_pointer_stack.c +++ b/libffi/testsuite/libffi.call/cls_pointer_stack.c @@ -98,7 +98,7 @@ int main (void) void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; -// ffi_type cls_pointer_type; + /* ffi_type cls_pointer_type; */ ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); @@ -125,18 +125,18 @@ int main (void) ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); - // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } - // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } - // { dg-output "\nres: 0x8bf258bd" } + /* { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } */ + /* { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } */ + /* { dg-output "\nres: 0x8bf258bd" } */ exit(0); } diff --git a/libffi/testsuite/libffi.call/cls_struct_va1.c b/libffi/testsuite/libffi.call/cls_struct_va1.c index 7262d630dd6..6d1fdaeb606 100644 --- a/libffi/testsuite/libffi.call/cls_struct_va1.c +++ b/libffi/testsuite/libffi.call/cls_struct_va1.c @@ -106,9 +106,9 @@ main (void) CHECK(ffi_prep_closure_loc(pcl, &cif, test_fn, NULL, code) == FFI_OK); res = ((int (*)(int, ...))(code))(si, s1, l1, s2); - // { dg-output "4 5 6 10 11 12 13 14 20 21" } + /* { dg-output "4 5 6 10 11 12 13 14 20 21" } */ printf("res: %d\n", (int) res); - // { dg-output "\nres: 42" } + /* { dg-output "\nres: 42" } */ exit(0); } diff --git a/libffi/testsuite/libffi.call/cls_ulonglong.c b/libffi/testsuite/libffi.call/cls_ulonglong.c index 235ab44ffc0..62f2cae63a9 100644 --- a/libffi/testsuite/libffi.call/cls_ulonglong.c +++ b/libffi/testsuite/libffi.call/cls_ulonglong.c @@ -11,7 +11,7 @@ static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { - *(unsigned long long *)resp= *(unsigned long long *)args[0]; + *(unsigned long long *)resp= 0xfffffffffffffffLL ^ *(unsigned long long *)args[0]; printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); @@ -34,14 +34,14 @@ int main (void) &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); - /* { dg-output "214: 214" } */ + /* { dg-output "214: 1152921504606846761" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 214" } */ + /* { dg-output "\nres: 1152921504606846761" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); - /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ + /* { dg-output "\n9223372035854775808: 8070450533247928831" } */ printf("res: %" PRIdLL "\n", res); - /* { dg-output "\nres: 9223372035854775808" } */ + /* { dg-output "\nres: 8070450533247928831" } */ exit(0); } diff --git a/libffi/testsuite/libffi.call/ffitest.h b/libffi/testsuite/libffi.call/ffitest.h index d81d4dabade..15d5e441234 100644 --- a/libffi/testsuite/libffi.call/ffitest.h +++ b/libffi/testsuite/libffi.call/ffitest.h @@ -15,22 +15,25 @@ #define MAX_ARGS 256 -#define CHECK(x) !(x) ? abort() : 0 +#define CHECK(x) (void)(!(x) ? (abort(), 1) : 0) -/* Define __UNUSED__ that also other compilers than gcc can run the tests. */ +/* Define macros so that compilers other than gcc can run the tests. */ #undef __UNUSED__ #if defined(__GNUC__) #define __UNUSED__ __attribute__((__unused__)) +#define __STDCALL__ __attribute__((stdcall)) +#define __THISCALL__ __attribute__((thiscall)) +#define __FASTCALL__ __attribute__((fastcall)) #else #define __UNUSED__ +#define __STDCALL__ __stdcall +#define __THISCALL__ __thiscall +#define __FASTCALL__ __fastcall #endif -/* Define __FASTCALL__ so that other compilers than gcc can run the tests. */ -#undef __FASTCALL__ -#if defined _MSC_VER -#define __FASTCALL__ __fastcall -#else -#define __FASTCALL__ __attribute__((fastcall)) +#ifndef ABI_NUM +#define ABI_NUM FFI_DEFAULT_ABI +#define ABI_ATTR #endif /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a @@ -127,44 +130,6 @@ #define PRId64 "I64d" #endif -#ifdef USING_MMAP -static inline void * -allocate_mmap (size_t size) -{ - void *page; -#if defined (HAVE_MMAP_DEV_ZERO) - static int dev_zero_fd = -1; -#endif - -#ifdef HAVE_MMAP_DEV_ZERO - if (dev_zero_fd == -1) - { - dev_zero_fd = open ("/dev/zero", O_RDONLY); - if (dev_zero_fd == -1) - { - perror ("open /dev/zero: %m"); - exit (1); - } - } -#endif - - -#ifdef HAVE_MMAP_ANON - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -#endif -#ifdef HAVE_MMAP_DEV_ZERO - page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, dev_zero_fd, 0); -#endif - - if (page == (void *) MAP_FAILED) - { - perror ("virtual memory exhausted"); - exit (1); - } - - return page; -} - +#ifndef PRIuPTR +#define PRIuPTR "u" #endif diff --git a/libffi/testsuite/libffi.call/float1.c b/libffi/testsuite/libffi.call/float1.c index 991d059fe40..c48493c6b22 100644 --- a/libffi/testsuite/libffi.call/float1.c +++ b/libffi/testsuite/libffi.call/float1.c @@ -8,6 +8,8 @@ #include "ffitest.h" #include "float.h" +#include <math.h> + typedef union { double d; @@ -47,7 +49,7 @@ int main (void) /* These are not always the same!! Check for a reasonable delta */ - CHECK(result[0].d - dblit(f) < DBL_EPSILON); + CHECK(fabs(result[0].d - dblit(f)) < DBL_EPSILON); /* Check the canary. */ for (i = 0; i < sizeof (double); ++i) diff --git a/libffi/testsuite/libffi.call/float2.c b/libffi/testsuite/libffi.call/float2.c index a0b296cf4b9..20a8c402ba4 100644 --- a/libffi/testsuite/libffi.call/float2.c +++ b/libffi/testsuite/libffi.call/float2.c @@ -3,13 +3,13 @@ Limitations: none. PR: none. Originator: From the original ffitest.c */ - -/* { dg-excess-errors "fails" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ -/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run } */ #include "ffitest.h" #include "float.h" +#include <math.h> + static long double ldblit(float f) { return (long double) (((long double) f)/ (long double) 3.0); @@ -49,7 +49,7 @@ int main (void) #endif /* These are not always the same!! Check for a reasonable delta */ - if (ld - ldblit(f) < LDBL_EPSILON) + if (fabsl(ld - ldblit(f)) < LDBL_EPSILON) puts("long double return value tests ok!"); else CHECK(0); diff --git a/libffi/testsuite/libffi.call/float3.c b/libffi/testsuite/libffi.call/float3.c index 76bd5f287cb..bab3206a174 100644 --- a/libffi/testsuite/libffi.call/float3.c +++ b/libffi/testsuite/libffi.call/float3.c @@ -9,6 +9,8 @@ #include "ffitest.h" #include "float.h" +#include <math.h> + static double floating_1(float a, double b, long double c) { return (double) a + b + (double) c; @@ -49,7 +51,7 @@ int main (void) ffi_call(&cif, FFI_FN(floating_1), &rd, values); - CHECK(rd - floating_1(f, d, ld) < DBL_EPSILON); + CHECK(fabs(rd - floating_1(f, d, ld)) < DBL_EPSILON); args[0] = &ffi_type_longdouble; values[0] = &ld; @@ -66,7 +68,7 @@ int main (void) ffi_call(&cif, FFI_FN(floating_2), &rd, values); - CHECK(rd - floating_2(ld, d, f) < DBL_EPSILON); + CHECK(fabs(rd - floating_2(ld, d, f)) < DBL_EPSILON); exit (0); } diff --git a/libffi/testsuite/libffi.call/float_va.c b/libffi/testsuite/libffi.call/float_va.c index aae158edcc1..5acff91f663 100644 --- a/libffi/testsuite/libffi.call/float_va.c +++ b/libffi/testsuite/libffi.call/float_va.c @@ -56,9 +56,9 @@ int main (void) * different. */ /* Call it statically and then via ffi */ resfp=float_va_fn(0,2.0); - // { dg-output "0: 2.0 : total: 2.0" } + /* { dg-output "0: 2.0 : total: 2.0" } */ printf("compiled: %.1f\n", resfp); - // { dg-output "\ncompiled: 2.0" } + /* { dg-output "\ncompiled: 2.0" } */ arg_types[0] = &ffi_type_uint; arg_types[1] = &ffi_type_double; @@ -71,16 +71,16 @@ int main (void) values[0] = &firstarg; values[1] = &doubles[0]; ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values); - // { dg-output "\n0: 2.0 : total: 2.0" } + /* { dg-output "\n0: 2.0 : total: 2.0" } */ printf("ffi: %.1f\n", resfp); - // { dg-output "\nffi: 2.0" } + /* { dg-output "\nffi: 2.0" } */ /* Second test, float_va_fn(2,2.0,3.0,4.0), now with variadic params */ /* Call it statically and then via ffi */ resfp=float_va_fn(2,2.0,3.0,4.0); - // { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } + /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */ printf("compiled: %.1f\n", resfp); - // { dg-output "\ncompiled: 11.0" } + /* { dg-output "\ncompiled: 11.0" } */ arg_types[0] = &ffi_type_uint; arg_types[1] = &ffi_type_double; @@ -99,9 +99,9 @@ int main (void) values[2] = &doubles[1]; values[3] = &doubles[2]; ffi_call(&cif, FFI_FN(float_va_fn), &resfp, values); - // { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } + /* { dg-output "\n2: 2.0 : 0:3.0 1:4.0 total: 11.0" } */ printf("ffi: %.1f\n", resfp); - // { dg-output "\nffi: 11.0" } + /* { dg-output "\nffi: 11.0" } */ exit(0); } diff --git a/libffi/testsuite/libffi.call/huge_struct.c b/libffi/testsuite/libffi.call/huge_struct.c index 380fedf4858..187c42cc334 100644 --- a/libffi/testsuite/libffi.call/huge_struct.c +++ b/libffi/testsuite/libffi.call/huge_struct.c @@ -5,10 +5,9 @@ Originator: Blake Chaffin 6/18/2007 */ -/* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ -/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-options -Wformat=0 { target moxie*-*-elf } } */ #include "ffitest.h" @@ -295,7 +294,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__) CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); - // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " @@ -308,7 +307,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__) retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); - // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); @@ -323,7 +322,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__) ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8); - // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " @@ -336,7 +335,7 @@ main(int argc __UNUSED__, const char** argv __UNUSED__) retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); - // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ return 0; } diff --git a/libffi/testsuite/libffi.call/many.c b/libffi/testsuite/libffi.call/many.c index 4869ba9dde0..336968c77a2 100644 --- a/libffi/testsuite/libffi.call/many.c +++ b/libffi/testsuite/libffi.call/many.c @@ -7,21 +7,11 @@ /* { dg-do run } */ #include "ffitest.h" +#include <stdlib.h> #include <float.h> +#include <math.h> -static float many(float f1, - float f2, - float f3, - float f4, - float f5, - float f6, - float f7, - float f8, - float f9, - float f10, - float f11, - float f12, - float f13) +static float ABI_ATTR many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { #if 0 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", @@ -30,7 +20,7 @@ static float many(float f1, (double) f11, (double) f12, (double) f13); #endif - return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); + return f1+f2+f3+f4+f5+f6+f7+f8+f9+f10+f11+f12+f13; } int main (void) @@ -50,7 +40,7 @@ int main (void) } /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 13, &ffi_type_float, args) == FFI_OK); ffi_call(&cif, FFI_FN(many), &f, values); @@ -62,7 +52,7 @@ int main (void) fa[8], fa[9], fa[10],fa[11],fa[12]); - if (f - ff < FLT_EPSILON) + if (fabs(f - ff) < FLT_EPSILON) exit(0); else abort(); diff --git a/libffi/testsuite/libffi.call/many2.c b/libffi/testsuite/libffi.call/many2.c index 10771592fc8..1c85746e4c4 100644 --- a/libffi/testsuite/libffi.call/many2.c +++ b/libffi/testsuite/libffi.call/many2.c @@ -12,14 +12,17 @@ typedef unsigned char u8; -__attribute__((noinline)) uint8_t +#ifdef __GNUC__ +__attribute__((noinline)) +#endif +uint8_t foo (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g) { return a + b + c + d + e + f + g; } -uint8_t +uint8_t ABI_ATTR bar (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g) { @@ -39,7 +42,7 @@ main (void) for (i = 0; i < NARGS; ++i) ffitypes[i] = &ffi_type_uint8; - CHECK (ffi_prep_cif (&cif, FFI_DEFAULT_ABI, NARGS, + CHECK (ffi_prep_cif (&cif, ABI_NUM, NARGS, &ffi_type_uint8, ffitypes) == FFI_OK); for (i = 0; i < NARGS; ++i) diff --git a/libffi/testsuite/libffi.call/many2_win32.c b/libffi/testsuite/libffi.call/many2_win32.c deleted file mode 100644 index 4adbe4d705f..00000000000 --- a/libffi/testsuite/libffi.call/many2_win32.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Area: ffi_call - Purpose: Check stdcall many call on X86_WIN32 systems. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ - -#include "ffitest.h" -#include <float.h> - -static float __attribute__((fastcall)) fastcall_many(float f1, - float f2, - float f3, - float f4, - float f5, - float f6, - float f7, - float f8, - float f9, - float f10, - float f11, - float f12, - float f13) -{ - return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[13]; - void *values[13]; - float fa[13]; - float f, ff; - unsigned long ul; - - for (ul = 0; ul < 13; ul++) - { - args[ul] = &ffi_type_float; - values[ul] = &fa[ul]; - fa[ul] = (float) ul; - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 13, - &ffi_type_float, args) == FFI_OK); - - ff = fastcall_many(fa[0], fa[1], - fa[2], fa[3], - fa[4], fa[5], - fa[6], fa[7], - fa[8], fa[9], - fa[10], fa[11], fa[12]); - - ffi_call(&cif, FFI_FN(fastcall_many), &f, values); - - if (f - ff < FLT_EPSILON) - printf("fastcall many arg tests ok!\n"); - else - CHECK(0); - exit(0); -} diff --git a/libffi/testsuite/libffi.call/many_double.c b/libffi/testsuite/libffi.call/many_double.c new file mode 100644 index 00000000000..4ef8c8ab28b --- /dev/null +++ b/libffi/testsuite/libffi.call/many_double.c @@ -0,0 +1,70 @@ +/* Area: ffi_call + Purpose: Check return value double, with many arguments + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +#include <stdlib.h> +#include <float.h> +#include <math.h> + +static double many(double f1, + double f2, + double f3, + double f4, + double f5, + double f6, + double f7, + double f8, + double f9, + double f10, + double f11, + double f12, + double f13) +{ +#if 0 + printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", + (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, + (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, + (double) f11, (double) f12, (double) f13); +#endif + + return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[13]; + void *values[13]; + double fa[13]; + double f, ff; + int i; + + for (i = 0; i < 13; i++) + { + args[i] = &ffi_type_double; + values[i] = &fa[i]; + fa[i] = (double) i; + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, + &ffi_type_double, args) == FFI_OK); + + ffi_call(&cif, FFI_FN(many), &f, values); + + ff = many(fa[0], fa[1], + fa[2], fa[3], + fa[4], fa[5], + fa[6], fa[7], + fa[8], fa[9], + fa[10],fa[11],fa[12]); + if (fabs(f - ff) < FLT_EPSILON) + exit(0); + else + abort(); +} diff --git a/libffi/testsuite/libffi.call/many_mixed.c b/libffi/testsuite/libffi.call/many_mixed.c new file mode 100644 index 00000000000..85ec36ecbef --- /dev/null +++ b/libffi/testsuite/libffi.call/many_mixed.c @@ -0,0 +1,78 @@ +/* Area: ffi_call + Purpose: Check return value double, with many arguments + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +#include <stdlib.h> +#include <float.h> +#include <math.h> + +static double many(double f1, + double f2, + long int i1, + double f3, + double f4, + long int i2, + double f5, + double f6, + long int i3, + double f7, + double f8, + long int i4, + double f9, + double f10, + long int i5, + double f11, + double f12, + long int i6, + double f13) +{ + return ((double) (i1 + i2 + i3 + i4 + i5 + i6) + (f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[19]; + void *values[19]; + double fa[19]; + long int la[19]; + double f, ff; + int i; + + for (i = 0; i < 19; i++) + { + if( (i - 2) % 3 == 0) { + args[i] = &ffi_type_slong; + la[i] = (long int) i; + values[i] = &la[i]; + } + else { + args[i] = &ffi_type_double; + fa[i] = (double) i; + values[i] = &fa[i]; + } + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 19, + &ffi_type_double, args) == FFI_OK); + + ffi_call(&cif, FFI_FN(many), &f, values); + + ff = many(fa[0], fa[1], la[2], + fa[3], fa[4], la[5], + fa[6], fa[7], la[8], + fa[9], fa[10], la[11], + fa[12], fa[13], la[14], + fa[15], fa[16], la[17], + fa[18]); + if (fabs(f - ff) < FLT_EPSILON) + exit(0); + else + abort(); +} diff --git a/libffi/testsuite/libffi.call/many_win32.c b/libffi/testsuite/libffi.call/many_win32.c deleted file mode 100644 index 1b2633227ad..00000000000 --- a/libffi/testsuite/libffi.call/many_win32.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Area: ffi_call - Purpose: Check stdcall many call on X86_WIN32 systems. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ - -#include "ffitest.h" -#include <float.h> - -static float __attribute__((stdcall)) stdcall_many(float f1, - float f2, - float f3, - float f4, - float f5, - float f6, - float f7, - float f8, - float f9, - float f10, - float f11, - float f12, - float f13) -{ - return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[13]; - void *values[13]; - float fa[13]; - float f, ff; - unsigned long ul; - - for (ul = 0; ul < 13; ul++) - { - args[ul] = &ffi_type_float; - values[ul] = &fa[ul]; - fa[ul] = (float) ul; - } - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13, - &ffi_type_float, args) == FFI_OK); - - ff = stdcall_many(fa[0], fa[1], - fa[2], fa[3], - fa[4], fa[5], - fa[6], fa[7], - fa[8], fa[9], - fa[10], fa[11], fa[12]); - - ffi_call(&cif, FFI_FN(stdcall_many), &f, values); - - if (f - ff < FLT_EPSILON) - printf("stdcall many arg tests ok!\n"); - else - CHECK(0); - exit(0); -} diff --git a/libffi/testsuite/libffi.call/negint.c b/libffi/testsuite/libffi.call/negint.c index 3168113027d..6e2f26fc100 100644 --- a/libffi/testsuite/libffi.call/negint.c +++ b/libffi/testsuite/libffi.call/negint.c @@ -5,7 +5,6 @@ Originator: From the original ffitest.c */ /* { dg-do run } */ -/* { dg-options -O2 } */ #include "ffitest.h" diff --git a/libffi/testsuite/libffi.call/nested_struct1.c b/libffi/testsuite/libffi.call/nested_struct1.c index 1087f7b1cfd..477a6b9bdee 100644 --- a/libffi/testsuite/libffi.call/nested_struct1.c +++ b/libffi/testsuite/libffi.call/nested_struct1.c @@ -156,6 +156,6 @@ int main (void) CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); - // CHECK( 1 == 0); + /* CHECK( 1 == 0); */ exit(0); } diff --git a/libffi/testsuite/libffi.call/nested_struct11.c b/libffi/testsuite/libffi.call/nested_struct11.c index fce69481888..351049382c6 100644 --- a/libffi/testsuite/libffi.call/nested_struct11.c +++ b/libffi/testsuite/libffi.call/nested_struct11.c @@ -1,7 +1,7 @@ /* Area: ffi_call, closure_call Purpose: Check parameter passing with nested structs of a single type. This tests the special cases - for homogenous floating-point aggregates in the + for homogeneous floating-point aggregates in the AArch64 PCS. Limitations: none. PR: none. diff --git a/libffi/testsuite/libffi.call/return_dbl.c b/libffi/testsuite/libffi.call/return_dbl.c index 1aab403d9c3..fd07e501794 100644 --- a/libffi/testsuite/libffi.call/return_dbl.c +++ b/libffi/testsuite/libffi.call/return_dbl.c @@ -9,6 +9,7 @@ static double return_dbl(double dbl) { + printf ("%f\n", dbl); return 2 * dbl; } int main (void) diff --git a/libffi/testsuite/libffi.call/return_ldl.c b/libffi/testsuite/libffi.call/return_ldl.c index 5c2fe65aece..52a92fe0711 100644 --- a/libffi/testsuite/libffi.call/return_ldl.c +++ b/libffi/testsuite/libffi.call/return_ldl.c @@ -3,8 +3,8 @@ Limitations: none. PR: none. Originator: <andreast@gcc.gnu.org> 20071113 */ +/* { dg-do run } */ -/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" static long double return_ldl(long double ldl) diff --git a/libffi/testsuite/libffi.call/return_uc.c b/libffi/testsuite/libffi.call/return_uc.c index 07c45de5110..6fe554619d5 100644 --- a/libffi/testsuite/libffi.call/return_uc.c +++ b/libffi/testsuite/libffi.call/return_uc.c @@ -32,7 +32,7 @@ int main (void) uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); - CHECK(rint == (signed int) uc); + CHECK((unsigned char)rint == uc); } exit(0); } diff --git a/libffi/testsuite/libffi.call/stret_large.c b/libffi/testsuite/libffi.call/stret_large.c index f32938c009c..71c2469e1c4 100644 --- a/libffi/testsuite/libffi.call/stret_large.c +++ b/libffi/testsuite/libffi.call/stret_large.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_108byte { double a; diff --git a/libffi/testsuite/libffi.call/stret_large2.c b/libffi/testsuite/libffi.call/stret_large2.c index 3b0ef9ac4a0..d9c750ee1c0 100644 --- a/libffi/testsuite/libffi.call/stret_large2.c +++ b/libffi/testsuite/libffi.call/stret_large2.c @@ -9,8 +9,8 @@ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" -// 13 FPRs: 104 bytes -// 14 FPRs: 112 bytes +/* 13 FPRs: 104 bytes */ +/* 14 FPRs: 112 bytes */ typedef struct struct_116byte { double a; diff --git a/libffi/testsuite/libffi.call/strlen.c b/libffi/testsuite/libffi.call/strlen.c index 3de45de7aaa..35b70ea4e2e 100644 --- a/libffi/testsuite/libffi.call/strlen.c +++ b/libffi/testsuite/libffi.call/strlen.c @@ -7,7 +7,7 @@ /* { dg-do run } */ #include "ffitest.h" -static size_t my_strlen(char *s) +static size_t ABI_ATTR my_strlen(char *s) { return (strlen(s)); } @@ -24,7 +24,7 @@ int main (void) values[0] = (void*) &s; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ffi_type_sint, args) == FFI_OK); s = "a"; diff --git a/libffi/testsuite/libffi.call/fastthis1_win32.c b/libffi/testsuite/libffi.call/strlen2.c index cbc4724ef8c..96282bc0a1f 100644 --- a/libffi/testsuite/libffi.call/fastthis1_win32.c +++ b/libffi/testsuite/libffi.call/strlen2.c @@ -1,14 +1,14 @@ /* Area: ffi_call - Purpose: Check fastcall fct call on X86_WIN32 systems. + Purpose: Check strlen function call with additional arguments. Limitations: none. PR: none. Originator: From the original ffitest.c */ -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +/* { dg-do run } */ #include "ffitest.h" -static size_t __FASTCALL__ my_fastcall_f(char *s, float a) +static size_t ABI_ATTR my_f(char *s, float a) { return (size_t) ((int) strlen(s) + (int) a); } @@ -27,24 +27,23 @@ int main (void) values[1] = (void*) &v2; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ffi_type_sint, args) == FFI_OK); s = "a"; v2 = 0.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 1); s = "1234567"; v2 = -1.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 6); s = "1234567890123456789012345"; v2 = 1.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 26); - printf("fastcall fct1 tests passed\n"); exit(0); } diff --git a/libffi/testsuite/libffi.call/strlen2_win32.c b/libffi/testsuite/libffi.call/strlen2_win32.c deleted file mode 100644 index 0d81061e758..00000000000 --- a/libffi/testsuite/libffi.call/strlen2_win32.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Area: ffi_call - Purpose: Check fastcall strlen call on X86_WIN32 systems. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ - -#include "ffitest.h" - -static size_t __FASTCALL__ my_fastcall_strlen(char *s) -{ - return (strlen(s)); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - char *s; - args[0] = &ffi_type_pointer; - values[0] = (void*) &s; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, - &ffi_type_sint, args) == FFI_OK); - - s = "a"; - ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); - CHECK(rint == 1); - - s = "1234567"; - ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); - CHECK(rint == 7); - - s = "1234567890123456789012345"; - ffi_call(&cif, FFI_FN(my_fastcall_strlen), &rint, values); - CHECK(rint == 25); - - printf("fastcall strlen tests passed\n"); - exit(0); -} diff --git a/libffi/testsuite/libffi.call/fastthis2_win32.c b/libffi/testsuite/libffi.call/strlen3.c index 7bdd0e17584..beba86e9eac 100644 --- a/libffi/testsuite/libffi.call/fastthis2_win32.c +++ b/libffi/testsuite/libffi.call/strlen3.c @@ -1,14 +1,14 @@ /* Area: ffi_call - Purpose: Check fastcall fct call on X86_WIN32 systems. + Purpose: Check strlen function call with additional arguments. Limitations: none. PR: none. Originator: From the original ffitest.c */ -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +/* { dg-do run } */ #include "ffitest.h" -static size_t __FASTCALL__ my_fastcall_f(float a, char *s) +static size_t ABI_ATTR my_f(float a, char *s) { return (size_t) ((int) strlen(s) + (int) a); } @@ -27,24 +27,23 @@ int main (void) values[0] = (void*) &v2; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 2, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ffi_type_sint, args) == FFI_OK); s = "a"; v2 = 0.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 1); s = "1234567"; v2 = -1.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 6); s = "1234567890123456789012345"; v2 = 1.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 26); - printf("fastcall fct2 tests passed\n"); exit(0); } diff --git a/libffi/testsuite/libffi.call/fastthis3_win32.c b/libffi/testsuite/libffi.call/strlen4.c index b5d606d9a15..d5d42b4f6dd 100644 --- a/libffi/testsuite/libffi.call/fastthis3_win32.c +++ b/libffi/testsuite/libffi.call/strlen4.c @@ -1,14 +1,14 @@ /* Area: ffi_call - Purpose: Check fastcall f call on X86_WIN32 systems. + Purpose: Check strlen function call with additional arguments. Limitations: none. PR: none. Originator: From the original ffitest.c */ -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +/* { dg-do run } */ #include "ffitest.h" -static size_t __FASTCALL__ my_fastcall_f(float a, char *s, int i) +static size_t ABI_ATTR my_f(float a, char *s, int i) { return (size_t) ((int) strlen(s) + (int) a + i); } @@ -30,27 +30,26 @@ int main (void) values[0] = (void*) &v2; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 3, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 3, &ffi_type_sint, args) == FFI_OK); s = "a"; v1 = 1; v2 = 0.0; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 2); s = "1234567"; v2 = -1.0; v1 = -2; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 4); s = "1234567890123456789012345"; v2 = 1.0; v1 = 2; - ffi_call(&cif, FFI_FN(my_fastcall_f), &rint, values); + ffi_call(&cif, FFI_FN(my_f), &rint, values); CHECK(rint == 28); - printf("fastcall fct3 tests passed\n"); exit(0); } diff --git a/libffi/testsuite/libffi.call/strlen_win32.c b/libffi/testsuite/libffi.call/strlen_win32.c deleted file mode 100644 index 6fbcc87400a..00000000000 --- a/libffi/testsuite/libffi.call/strlen_win32.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Area: ffi_call - Purpose: Check stdcall strlen call on X86_WIN32 systems. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ - -#include "ffitest.h" - -static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s) -{ - return (strlen(s)); -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_arg rint; - char *s; - args[0] = &ffi_type_pointer; - values[0] = (void*) &s; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1, - &ffi_type_sint, args) == FFI_OK); - - s = "a"; - ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); - CHECK(rint == 1); - - s = "1234567"; - ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); - CHECK(rint == 7); - - s = "1234567890123456789012345"; - ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); - CHECK(rint == 25); - - printf("stdcall strlen tests passed\n"); - exit(0); -} diff --git a/libffi/testsuite/libffi.call/struct1.c b/libffi/testsuite/libffi.call/struct1.c index bfc23f642cc..c13e23f8727 100644 --- a/libffi/testsuite/libffi.call/struct1.c +++ b/libffi/testsuite/libffi.call/struct1.c @@ -14,7 +14,7 @@ typedef struct unsigned int ui; } test_structure_1; -static test_structure_1 struct1(test_structure_1 ts) +static test_structure_1 ABI_ATTR struct1(test_structure_1 ts) { ts.uc++; ts.d--; @@ -50,7 +50,7 @@ int main (void) values[0] = &ts1_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts1_type, args) == FFI_OK); ts1_arg.uc = '\x01'; diff --git a/libffi/testsuite/libffi.call/struct1_win32.c b/libffi/testsuite/libffi.call/struct1_win32.c deleted file mode 100644 index b756f5ad8b5..00000000000 --- a/libffi/testsuite/libffi.call/struct1_win32.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures with fastcall/thiscall convention. - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ -#include "ffitest.h" - -typedef struct -{ - unsigned char uc; - double d; - unsigned int ui; -} test_structure_1; - -static test_structure_1 __FASTCALL__ struct1(test_structure_1 ts) -{ - ts.uc++; - ts.d--; - ts.ui++; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - ffi_type ts1_type; - ffi_type *ts1_type_elements[4]; - - test_structure_1 ts1_arg; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_1 *ts1_result = - (test_structure_1 *) malloc (sizeof(test_structure_1)); - - ts1_type.size = 0; - ts1_type.alignment = 0; - ts1_type.type = FFI_TYPE_STRUCT; - ts1_type.elements = ts1_type_elements; - ts1_type_elements[0] = &ffi_type_uchar; - ts1_type_elements[1] = &ffi_type_double; - ts1_type_elements[2] = &ffi_type_uint; - ts1_type_elements[3] = NULL; - - args[0] = &ts1_type; - values[0] = &ts1_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, - &ts1_type, args) == FFI_OK); - - ts1_arg.uc = '\x01'; - ts1_arg.d = 3.14159; - ts1_arg.ui = 555; - - ffi_call(&cif, FFI_FN(struct1), ts1_result, values); - - CHECK(ts1_result->ui == 556); - CHECK(ts1_result->d == 3.14159 - 1); - - free (ts1_result); - exit(0); -} diff --git a/libffi/testsuite/libffi.call/struct2.c b/libffi/testsuite/libffi.call/struct2.c index d85385e7d3f..5077a5ee45a 100644 --- a/libffi/testsuite/libffi.call/struct2.c +++ b/libffi/testsuite/libffi.call/struct2.c @@ -13,7 +13,7 @@ typedef struct double d2; } test_structure_2; -static test_structure_2 struct2(test_structure_2 ts) +static test_structure_2 ABI_ATTR struct2(test_structure_2 ts) { ts.d1--; ts.d2--; @@ -46,7 +46,7 @@ int main (void) values[0] = &ts2_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts2_type, args) == FFI_OK); ts2_arg.d1 = 5.55; ts2_arg.d2 = 6.66; diff --git a/libffi/testsuite/libffi.call/struct2_win32.c b/libffi/testsuite/libffi.call/struct2_win32.c deleted file mode 100644 index 5d022855c57..00000000000 --- a/libffi/testsuite/libffi.call/struct2_win32.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Area: ffi_call - Purpose: Check structures in fastcall/stdcall function - Limitations: none. - PR: none. - Originator: From the original ffitest.c */ - -/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ -#include "ffitest.h" - -typedef struct -{ - double d1; - double d2; -} test_structure_2; - -static test_structure_2 __FASTCALL__ struct2(test_structure_2 ts) -{ - ts.d1--; - ts.d2--; - - return ts; -} - -int main (void) -{ - ffi_cif cif; - ffi_type *args[MAX_ARGS]; - void *values[MAX_ARGS]; - test_structure_2 ts2_arg; - ffi_type ts2_type; - ffi_type *ts2_type_elements[3]; - - /* This is a hack to get a properly aligned result buffer */ - test_structure_2 *ts2_result = - (test_structure_2 *) malloc (sizeof(test_structure_2)); - - ts2_type.size = 0; - ts2_type.alignment = 0; - ts2_type.type = FFI_TYPE_STRUCT; - ts2_type.elements = ts2_type_elements; - ts2_type_elements[0] = &ffi_type_double; - ts2_type_elements[1] = &ffi_type_double; - ts2_type_elements[2] = NULL; - - args[0] = &ts2_type; - values[0] = &ts2_arg; - - /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_FASTCALL, 1, &ts2_type, args) == FFI_OK); - - ts2_arg.d1 = 5.55; - ts2_arg.d2 = 6.66; - - printf ("%g\n", ts2_arg.d1); - printf ("%g\n", ts2_arg.d2); - - ffi_call(&cif, FFI_FN(struct2), ts2_result, values); - - printf ("%g\n", ts2_result->d1); - printf ("%g\n", ts2_result->d2); - - CHECK(ts2_result->d1 == 5.55 - 1); - CHECK(ts2_result->d2 == 6.66 - 1); - - free (ts2_result); - exit(0); -} diff --git a/libffi/testsuite/libffi.call/struct3.c b/libffi/testsuite/libffi.call/struct3.c index de883c2638e..7eba0ead6d6 100644 --- a/libffi/testsuite/libffi.call/struct3.c +++ b/libffi/testsuite/libffi.call/struct3.c @@ -12,7 +12,7 @@ typedef struct int si; } test_structure_3; -static test_structure_3 struct3(test_structure_3 ts) +static test_structure_3 ABI_ATTR struct3(test_structure_3 ts) { ts.si = -(ts.si*2); @@ -43,7 +43,7 @@ int main (void) values[0] = &ts3_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts3_type, args) == FFI_OK); ts3_arg.si = -123; diff --git a/libffi/testsuite/libffi.call/struct4.c b/libffi/testsuite/libffi.call/struct4.c index 48e03495441..66a9551dd65 100644 --- a/libffi/testsuite/libffi.call/struct4.c +++ b/libffi/testsuite/libffi.call/struct4.c @@ -14,7 +14,7 @@ typedef struct unsigned ui3; } test_structure_4; -static test_structure_4 struct4(test_structure_4 ts) +static test_structure_4 ABI_ATTR struct4(test_structure_4 ts) { ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3; @@ -48,7 +48,7 @@ int main (void) values[0] = &ts4_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts4_type, args) == FFI_OK); ts4_arg.ui1 = 2; ts4_arg.ui2 = 3; diff --git a/libffi/testsuite/libffi.call/struct5.c b/libffi/testsuite/libffi.call/struct5.c index 28b1f0c4265..23e2a3f745c 100644 --- a/libffi/testsuite/libffi.call/struct5.c +++ b/libffi/testsuite/libffi.call/struct5.c @@ -12,7 +12,7 @@ typedef struct char c2; } test_structure_5; -static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2) +static test_structure_5 ABI_ATTR struct5(test_structure_5 ts1, test_structure_5 ts2) { ts1.c1 += ts2.c1; ts1.c2 -= ts2.c2; @@ -48,7 +48,7 @@ int main (void) values[1] = &ts5_arg2; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts5_type, args) == FFI_OK); ts5_arg1.c1 = 2; ts5_arg1.c2 = 6; diff --git a/libffi/testsuite/libffi.call/struct6.c b/libffi/testsuite/libffi.call/struct6.c index 0e267467a7b..173c66eb4d2 100644 --- a/libffi/testsuite/libffi.call/struct6.c +++ b/libffi/testsuite/libffi.call/struct6.c @@ -12,7 +12,7 @@ typedef struct double d; } test_structure_6; -static test_structure_6 struct6 (test_structure_6 ts) +static test_structure_6 ABI_ATTR struct6 (test_structure_6 ts) { ts.f += 1; ts.d += 1; @@ -46,7 +46,7 @@ int main (void) values[0] = &ts6_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts6_type, args) == FFI_OK); ts6_arg.f = 5.55f; ts6_arg.d = 6.66; diff --git a/libffi/testsuite/libffi.call/struct7.c b/libffi/testsuite/libffi.call/struct7.c index 8f2bbfd949c..badc7e05560 100644 --- a/libffi/testsuite/libffi.call/struct7.c +++ b/libffi/testsuite/libffi.call/struct7.c @@ -13,7 +13,7 @@ typedef struct double d; } test_structure_7; -static test_structure_7 struct7 (test_structure_7 ts) +static test_structure_7 ABI_ATTR struct7 (test_structure_7 ts) { ts.f1 += 1; ts.f2 += 1; @@ -49,7 +49,7 @@ int main (void) values[0] = &ts7_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts7_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts7_type, args) == FFI_OK); ts7_arg.f1 = 5.55f; ts7_arg.f2 = 55.5f; diff --git a/libffi/testsuite/libffi.call/struct8.c b/libffi/testsuite/libffi.call/struct8.c index 266e1f0ad60..ef204ecbbce 100644 --- a/libffi/testsuite/libffi.call/struct8.c +++ b/libffi/testsuite/libffi.call/struct8.c @@ -14,7 +14,7 @@ typedef struct float f4; } test_structure_8; -static test_structure_8 struct8 (test_structure_8 ts) +static test_structure_8 ABI_ATTR struct8 (test_structure_8 ts) { ts.f1 += 1; ts.f2 += 1; @@ -52,7 +52,7 @@ int main (void) values[0] = &ts8_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts8_type, args) == FFI_OK); ts8_arg.f1 = 5.55f; ts8_arg.f2 = 55.5f; diff --git a/libffi/testsuite/libffi.call/struct9.c b/libffi/testsuite/libffi.call/struct9.c index efeb7161b84..4a13b818c4e 100644 --- a/libffi/testsuite/libffi.call/struct9.c +++ b/libffi/testsuite/libffi.call/struct9.c @@ -13,7 +13,7 @@ typedef struct int i; } test_structure_9; -static test_structure_9 struct9 (test_structure_9 ts) +static test_structure_9 ABI_ATTR struct9 (test_structure_9 ts) { ts.f += 1; ts.i += 1; @@ -47,7 +47,7 @@ int main (void) values[0] = &ts9_arg; /* Initialize the cif */ - CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts9_type, args) == FFI_OK); + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts9_type, args) == FFI_OK); ts9_arg.f = 5.55f; ts9_arg.i = 5; |