2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libffi / testsuite / libffi.call / many.c
blob4869ba9dde077da9bfee8d5607e4ee7727744947
1 /* Area: ffi_call
2 Purpose: Check return value float, with many arguments
3 Limitations: none.
4 PR: none.
5 Originator: From the original ffitest.c */
7 /* { dg-do run } */
8 #include "ffitest.h"
10 #include <float.h>
12 static float many(float f1,
13 float f2,
14 float f3,
15 float f4,
16 float f5,
17 float f6,
18 float f7,
19 float f8,
20 float f9,
21 float f10,
22 float f11,
23 float f12,
24 float f13)
26 #if 0
27 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
28 (double) f1, (double) f2, (double) f3, (double) f4, (double) f5,
29 (double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
30 (double) f11, (double) f12, (double) f13);
31 #endif
33 return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
36 int main (void)
38 ffi_cif cif;
39 ffi_type *args[13];
40 void *values[13];
41 float fa[13];
42 float f, ff;
43 int i;
45 for (i = 0; i < 13; i++)
47 args[i] = &ffi_type_float;
48 values[i] = &fa[i];
49 fa[i] = (float) i;
52 /* Initialize the cif */
53 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13,
54 &ffi_type_float, args) == FFI_OK);
56 ffi_call(&cif, FFI_FN(many), &f, values);
58 ff = many(fa[0], fa[1],
59 fa[2], fa[3],
60 fa[4], fa[5],
61 fa[6], fa[7],
62 fa[8], fa[9],
63 fa[10],fa[11],fa[12]);
65 if (f - ff < FLT_EPSILON)
66 exit(0);
67 else
68 abort();