Make-lang.in: Update dependencies.
[official-gcc.git] / libffi / testsuite / libffi.call / negint.c
blob3168113027db434c883a2055ac7ee7ee32748d0a
1 /* Area: ffi_call
2 Purpose: Check that negative integers are passed correctly.
3 Limitations: none.
4 PR: none.
5 Originator: From the original ffitest.c */
7 /* { dg-do run } */
8 /* { dg-options -O2 } */
10 #include "ffitest.h"
12 static int checking(int a, short b, signed char c)
15 return (a < 0 && b < 0 && c < 0);
18 int main (void)
20 ffi_cif cif;
21 ffi_type *args[MAX_ARGS];
22 void *values[MAX_ARGS];
23 ffi_arg rint;
25 signed int si;
26 signed short ss;
27 signed char sc;
29 args[0] = &ffi_type_sint;
30 values[0] = &si;
31 args[1] = &ffi_type_sshort;
32 values[1] = &ss;
33 args[2] = &ffi_type_schar;
34 values[2] = &sc;
36 /* Initialize the cif */
37 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
38 &ffi_type_sint, args) == FFI_OK);
40 si = -6;
41 ss = -12;
42 sc = -1;
44 checking (si, ss, sc);
46 ffi_call(&cif, FFI_FN(checking), &rint, values);
48 printf ("%d vs %d\n", (int)rint, checking (si, ss, sc));
50 CHECK(rint != 0);
52 exit (0);