bf8da5fc77
* configure.ac: Tidy target case. (HAVE_LONG_DOUBLE): Allow the target to override. * configure: Regenerate. * include/ffi.h.in: Don't define ffi_type_foo if LIBFFI_HIDE_BASIC_TYPES is defined. (ffi_type_longdouble): If not HAVE_LONG_DOUBLE, define to ffi_type_double. * types.c (LIBFFI_HIDE_BASIC_TYPES): Define. (FFI_TYPEDEF, ffi_type_void): Mark the data const. (ffi_type_longdouble): Special case for Alpha. Don't define if long double == double. * src/alpha/ffi.c (FFI_TYPE_LONGDOUBLE): Assert unique value. (ffi_prep_cif_machdep): Handle it as the 128-bit type. (ffi_call, ffi_closure_osf_inner): Likewise. (ffi_closure_osf_inner): Likewise. Mark hidden. (ffi_call_osf, ffi_closure_osf): Mark hidden. * src/alpha/ffitarget.h (FFI_LAST_ABI): Tidy definition. * src/alpha/osf.S (ffi_call_osf, ffi_closure_osf): Mark hidden. (load_table): Handle 128-bit long double. * testsuite/libffi.call/float4.c: Add -mieee for alpha. From-SVN: r123622
63 lines
1.3 KiB
C
63 lines
1.3 KiB
C
/* Area: ffi_call
|
|
Purpose: Check denorm double value.
|
|
Limitations: none.
|
|
PR: PR26483.
|
|
Originator: From the original ffitest.c */
|
|
|
|
/* { dg-do run } */
|
|
/* { dg-options "-mieee" { target alpha*-*-* } } */
|
|
|
|
#include "ffitest.h"
|
|
#include "float.h"
|
|
|
|
typedef union
|
|
{
|
|
double d;
|
|
unsigned char c[sizeof (double)];
|
|
} value_type;
|
|
|
|
#define CANARY 0xba
|
|
|
|
static double dblit(double d)
|
|
{
|
|
return d;
|
|
}
|
|
|
|
int main (void)
|
|
{
|
|
ffi_cif cif;
|
|
ffi_type *args[MAX_ARGS];
|
|
void *values[MAX_ARGS];
|
|
double d;
|
|
value_type result[2];
|
|
unsigned int i;
|
|
|
|
args[0] = &ffi_type_double;
|
|
values[0] = &d;
|
|
|
|
/* Initialize the cif */
|
|
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
|
|
&ffi_type_double, args) == FFI_OK);
|
|
|
|
d = DBL_MIN / 2;
|
|
|
|
/* Put a canary in the return array. This is a regression test for
|
|
a buffer overrun. */
|
|
memset(result[1].c, CANARY, sizeof (double));
|
|
|
|
ffi_call(&cif, FFI_FN(dblit), &result[0].d, values);
|
|
|
|
/* The standard delta check doesn't work for denorms. Since we didn't do
|
|
any arithmetic, we should get the original result back, and hence an
|
|
exact check should be OK here. */
|
|
|
|
CHECK(result[0].d == dblit(d));
|
|
|
|
/* Check the canary. */
|
|
for (i = 0; i < sizeof (double); ++i)
|
|
CHECK(result[1].c[i] == CANARY);
|
|
|
|
exit(0);
|
|
|
|
}
|