ยปCore Development>Code coverage>Modules/_ctypes/libffi/testsuite/libffi.call/return_ul.c

Python code coverage for Modules/_ctypes/libffi/testsuite/libffi.call/return_ul.c

#countcontent
1n/a/* Area: ffi_call
2n/a Purpose: Check if unsigned long as return type is handled correctly.
3n/a Limitations: none.
4n/a PR: none.
5n/a Originator: <kaffeetisch at gmx dot de> 20060724 */
6n/a
7n/a/* { dg-do run } */
8n/a#include "ffitest.h"
9n/astatic unsigned long return_ul(unsigned long ul1, unsigned long ul2)
10n/a{
11n/a return ul1 + ul2;
12n/a}
13n/a
14n/aint main (void)
15n/a{
16n/a ffi_cif cif;
17n/a ffi_type *args[MAX_ARGS];
18n/a void *values[MAX_ARGS];
19n/a ffi_arg res;
20n/a unsigned long ul1, ul2;
21n/a
22n/a args[0] = &ffi_type_ulong;
23n/a args[1] = &ffi_type_ulong;
24n/a values[0] = &ul1;
25n/a values[1] = &ul2;
26n/a
27n/a CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
28n/a &ffi_type_ulong, args) == FFI_OK);
29n/a
30n/a ul1 = 1073741823L;
31n/a ul2 = 1073741824L;
32n/a
33n/a ffi_call(&cif, FFI_FN(return_ul), &res, values);
34n/a printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2);
35n/a /* { dg-output "res: 2147483647, 2147483647" } */
36n/a
37n/a exit(0);
38n/a}