2 Purpose: Check return value float.
5 Originator: <rfm@gnu.org> 20091102 */
10 typedef struct cls_struct_combined
{
15 } cls_struct_combined
;
17 void cls_struct_combined_fn(struct cls_struct_combined arg
)
19 printf("%g %g %g %g\n",
26 cls_struct_combined_gn(ffi_cif
* cif __UNUSED__
, void* resp __UNUSED__
,
27 void** args
, void* userdata __UNUSED__
)
29 struct cls_struct_combined a0
;
31 a0
= *(struct cls_struct_combined
*)(args
[0]);
33 cls_struct_combined_fn(a0
);
41 ffi_closure
*pcl
= ffi_closure_alloc(sizeof(ffi_closure
), &code
);
42 ffi_type
* cls_struct_fields0
[5];
43 ffi_type cls_struct_type0
;
44 ffi_type
* dbl_arg_types
[5];
46 struct cls_struct_combined g_dbl
= {4.0, 5.0, 1.0, 8.0};
48 cls_struct_type0
.size
= 0;
49 cls_struct_type0
.alignment
= 0;
50 cls_struct_type0
.type
= FFI_TYPE_STRUCT
;
51 cls_struct_type0
.elements
= cls_struct_fields0
;
53 cls_struct_fields0
[0] = &ffi_type_float
;
54 cls_struct_fields0
[1] = &ffi_type_float
;
55 cls_struct_fields0
[2] = &ffi_type_float
;
56 cls_struct_fields0
[3] = &ffi_type_float
;
57 cls_struct_fields0
[4] = NULL
;
59 dbl_arg_types
[0] = &cls_struct_type0
;
60 dbl_arg_types
[1] = NULL
;
62 CHECK(ffi_prep_cif(&cif
, FFI_DEFAULT_ABI
, 1, &ffi_type_void
,
63 dbl_arg_types
) == FFI_OK
);
65 CHECK(ffi_prep_closure_loc(pcl
, &cif
, cls_struct_combined_gn
, NULL
, code
) == FFI_OK
);
67 ((void(*)(cls_struct_combined
)) (code
))(g_dbl
);
68 /* { dg-output "4 5 1 8" } */