1 /**
2 Copyright 1993 Bill Triggs <Bill.Triggs@inrialpes.fr>
3 Copyright 1995-2017 Bruno Haible <bruno@clisp.org>
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 **/
18
19 /* { dg-do run } */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <ffi.h>
25 #include "alignof.h"
26 #include <stdarg.h>
27
28 /* libffi testsuite local changes -------------------------------- */
29 #ifdef DGTEST
30 /* Redefine exit(1) as a test failure */
31 #define exit(V) (void)((V) ? (abort(), 1) : exit(0))
32 int count = 0;
33 char rbuf1[2048];
34 char rbuf2[2048];
_fprintf(FILE * stream,const char * format,...)35 int _fprintf(FILE *stream, const char *format, ...)
36 {
37 va_list args;
38 va_start(args, format);
39
40 switch (count++)
41 {
42 case 0:
43 case 1:
44 vsprintf(&rbuf1[strlen(rbuf1)], format, args);
45 break;
46 case 2:
47 printf("%s", rbuf1);
48 vsprintf(rbuf2, format, args);
49 break;
50 case 3:
51 vsprintf(&rbuf2[strlen(rbuf2)], format, args);
52 printf("%s", rbuf2);
53 if (strcmp (rbuf1, rbuf2)) abort();
54 break;
55 }
56
57 va_end(args);
58
59 return 0;
60 }
61 #define fprintf _fprintf
62 #endif
63 /* --------------------------------------------------------------- */
64
65 #include "testcases.c"
66
67 #ifndef ABI_NUM
68 #define ABI_NUM FFI_DEFAULT_ABI
69 #endif
70
71 /* Definitions that ought to be part of libffi. */
72 static ffi_type ffi_type_char;
73 #define ffi_type_slonglong ffi_type_sint64
74 #define ffi_type_ulonglong ffi_type_uint64
75
76 /* libffi does not support arrays inside structs. */
77 #define SKIP_EXTRA_STRUCTS
78
79 #define FFI_PREP_CIF(cif,argtypes,rettype) \
80 if (ffi_prep_cif(&(cif),ABI_NUM,sizeof(argtypes)/sizeof(argtypes[0]),&rettype,argtypes) != FFI_OK) abort()
81 #define FFI_PREP_CIF_NOARGS(cif,rettype) \
82 if (ffi_prep_cif(&(cif),ABI_NUM,0,&rettype,NULL) != FFI_OK) abort()
83 #define FFI_CALL(cif,fn,args,retaddr) \
84 ffi_call(&(cif),(void(*)(void))(fn),retaddr,args)
85
clear_traces_i(long a,long b,long c,long d,long e,long f,long g,long h,long i,long j,long k,long l,long m,long n,long o,long p)86 long clear_traces_i (long a, long b, long c, long d, long e, long f, long g, long h,
87 long i, long j, long k, long l, long m, long n, long o, long p)
88 { return 0; }
clear_traces_f(float a,float b,float c,float d,float e,float f,float g,float h,float i,float j,float k,float l,float m,float n,float o,float p)89 float clear_traces_f (float a, float b, float c, float d, float e, float f, float g,
90 float h, float i, float j, float k, float l, float m, float n,
91 float o, float p)
92 { return 0.0; }
clear_traces_d(double a,double b,double c,double d,double e,double f,double g,double h,double i,double j,double k,double l,double m,double n,double o,double p)93 double clear_traces_d (double a, double b, double c, double d, double e, double f, double g,
94 double h, double i, double j, double k, double l, double m, double n,
95 double o, double p)
96 { return 0.0; }
clear_traces_J(void)97 J clear_traces_J (void)
98 { J j; j.l1 = j.l2 = 0; return j; }
clear_traces(void)99 void clear_traces (void)
100 { clear_traces_i(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
101 clear_traces_f(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
102 clear_traces_d(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
103 clear_traces_J();
104 }
105
106 void
void_tests(void)107 void_tests (void)
108 {
109 #if (!defined(DGTEST)) || DGTEST == 1
110 v_v();
111 clear_traces();
112 {
113 ffi_cif cif;
114 FFI_PREP_CIF_NOARGS(cif,ffi_type_void);
115 {
116 FFI_CALL(cif,v_v,NULL,NULL);
117 }
118 }
119 #endif
120 return;
121 }
122 void
int_tests(void)123 int_tests (void)
124 {
125 int ir;
126 ffi_arg retvalue;
127 #if (!defined(DGTEST)) || DGTEST == 2
128 ir = i_v();
129 fprintf(out,"->%d\n",ir);
130 fflush(out);
131 ir = 0; clear_traces();
132 {
133 ffi_cif cif;
134 FFI_PREP_CIF_NOARGS(cif,ffi_type_sint);
135 {
136 FFI_CALL(cif,i_v,NULL,&retvalue);
137 ir = retvalue;
138 }
139 }
140 fprintf(out,"->%d\n",ir);
141 fflush(out);
142 #endif
143
144 #if (!defined(DGTEST)) || DGTEST == 3
145 ir = i_i(i1);
146 fprintf(out,"->%d\n",ir);
147 fflush(out);
148 ir = 0; clear_traces();
149 {
150 ffi_type* argtypes[] = { &ffi_type_sint };
151 ffi_cif cif;
152 FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
153 {
154 /*const*/ void* args[] = { &i1 };
155 FFI_CALL(cif,i_i,args,&retvalue);
156 ir = retvalue;
157 }
158 }
159 fprintf(out,"->%d\n",ir);
160 fflush(out);
161 #endif
162
163 #if (!defined(DGTEST)) || DGTEST == 4
164 ir = i_i2(i1,i2);
165 fprintf(out,"->%d\n",ir);
166 fflush(out);
167 ir = 0; clear_traces();
168 {
169 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint };
170 ffi_cif cif;
171 FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
172 {
173 /*const*/ void* args[] = { &i1, &i2 };
174 FFI_CALL(cif,i_i2,args,&retvalue);
175 ir = retvalue;
176 }
177 }
178 fprintf(out,"->%d\n",ir);
179 fflush(out);
180 #endif
181
182 #if (!defined(DGTEST)) || DGTEST == 5
183 ir = i_i4(i1,i2,i3,i4);
184 fprintf(out,"->%d\n",ir);
185 fflush(out);
186 ir = 0; clear_traces();
187 {
188 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint };
189 ffi_cif cif;
190 FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
191 {
192 /*const*/ void* args[] = { &i1, &i2, &i3, &i4 };
193 FFI_CALL(cif,i_i4,args,&retvalue);
194 ir = retvalue;
195 }
196 }
197 fprintf(out,"->%d\n",ir);
198 fflush(out);
199 #endif
200
201 #if (!defined(DGTEST)) || DGTEST == 6
202 ir = i_i8(i1,i2,i3,i4,i5,i6,i7,i8);
203 fprintf(out,"->%d\n",ir);
204 fflush(out);
205 ir = 0; clear_traces();
206 {
207 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint };
208 ffi_cif cif;
209 FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
210 {
211 /*const*/ void* args[] = { &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8 };
212 FFI_CALL(cif,i_i8,args,&retvalue);
213 ir = retvalue;
214 }
215 }
216 fprintf(out,"->%d\n",ir);
217 fflush(out);
218 #endif
219
220 #if (!defined(DGTEST)) || DGTEST == 7
221 ir = i_i16(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16);
222 fprintf(out,"->%d\n",ir);
223 fflush(out);
224 ir = 0; clear_traces();
225 {
226 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_sint };
227 ffi_cif cif;
228 FFI_PREP_CIF(cif,argtypes,ffi_type_sint);
229 {
230 /*const*/ void* args[] = { &i1, &i2, &i3, &i4, &i5, &i6, &i7, &i8, &i9, &i10, &i11, &i12, &i13, &i14, &i15, &i16 };
231 FFI_CALL(cif,i_i16,args,&retvalue);
232 ir = retvalue;
233 }
234 }
235 fprintf(out,"->%d\n",ir);
236 fflush(out);
237 #endif
238
239 return;
240 }
241 void
float_tests(void)242 float_tests (void)
243 {
244 float fr;
245
246 #if (!defined(DGTEST)) || DGTEST == 8
247 fr = f_f(f1);
248 fprintf(out,"->%g\n",fr);
249 fflush(out);
250 fr = 0.0; clear_traces();
251 {
252 ffi_type* argtypes[] = { &ffi_type_float };
253 ffi_cif cif;
254 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
255 {
256 /*const*/ void* args[] = { &f1 };
257 FFI_CALL(cif,f_f,args,&fr);
258 }
259 }
260 fprintf(out,"->%g\n",fr);
261 fflush(out);
262 #endif
263
264 #if (!defined(DGTEST)) || DGTEST == 9
265 fr = f_f2(f1,f2);
266 fprintf(out,"->%g\n",fr);
267 fflush(out);
268 fr = 0.0; clear_traces();
269 {
270 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float };
271 ffi_cif cif;
272 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
273 {
274 /*const*/ void* args[] = { &f1, &f2 };
275 FFI_CALL(cif,f_f2,args,&fr);
276 }
277 }
278 fprintf(out,"->%g\n",fr);
279 fflush(out);
280 #endif
281
282 #if (!defined(DGTEST)) || DGTEST == 10
283 fr = f_f4(f1,f2,f3,f4);
284 fprintf(out,"->%g\n",fr);
285 fflush(out);
286 fr = 0.0; clear_traces();
287 {
288 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
289 ffi_cif cif;
290 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
291 {
292 /*const*/ void* args[] = { &f1, &f2, &f3, &f4 };
293 FFI_CALL(cif,f_f4,args,&fr);
294 }
295 }
296 fprintf(out,"->%g\n",fr);
297 fflush(out);
298 #endif
299
300 #if (!defined(DGTEST)) || DGTEST == 11
301 fr = f_f8(f1,f2,f3,f4,f5,f6,f7,f8);
302 fprintf(out,"->%g\n",fr);
303 fflush(out);
304 fr = 0.0; clear_traces();
305 {
306 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
307 ffi_cif cif;
308 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
309 {
310 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8 };
311 FFI_CALL(cif,f_f8,args,&fr);
312 }
313 }
314 fprintf(out,"->%g\n",fr);
315 fflush(out);
316 #endif
317
318 #if (!defined(DGTEST)) || DGTEST == 12
319 fr = f_f16(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16);
320 fprintf(out,"->%g\n",fr);
321 fflush(out);
322 fr = 0.0; clear_traces();
323 {
324 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
325 ffi_cif cif;
326 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
327 {
328 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9, &f10, &f11, &f12, &f13, &f14, &f15, &f16 };
329 FFI_CALL(cif,f_f16,args,&fr);
330 }
331 }
332 fprintf(out,"->%g\n",fr);
333 fflush(out);
334 #endif
335
336 #if (!defined(DGTEST)) || DGTEST == 13
337 fr = f_f24(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24);
338 fprintf(out,"->%g\n",fr);
339 fflush(out);
340 fr = 0.0; clear_traces();
341 {
342 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float };
343 ffi_cif cif;
344 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
345 {
346 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9, &f10, &f11, &f12, &f13, &f14, &f15, &f16, &f17, &f18, &f19, &f20, &f21, &f22, &f23, &f24 };
347 FFI_CALL(cif,f_f24,args,&fr);
348 }
349 }
350 fprintf(out,"->%g\n",fr);
351 fflush(out);
352 #endif
353 }
354 void
double_tests(void)355 double_tests (void)
356 {
357 double dr;
358
359 #if (!defined(DGTEST)) || DGTEST == 14
360
361 dr = d_d(d1);
362 fprintf(out,"->%g\n",dr);
363 fflush(out);
364 dr = 0.0; clear_traces();
365 {
366 ffi_type* argtypes[] = { &ffi_type_double };
367 ffi_cif cif;
368 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
369 {
370 /*const*/ void* args[] = { &d1 };
371 FFI_CALL(cif,d_d,args,&dr);
372 }
373 }
374 fprintf(out,"->%g\n",dr);
375 fflush(out);
376 #endif
377
378 #if (!defined(DGTEST)) || DGTEST == 15
379 dr = d_d2(d1,d2);
380 fprintf(out,"->%g\n",dr);
381 fflush(out);
382 dr = 0.0; clear_traces();
383 {
384 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double };
385 ffi_cif cif;
386 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
387 {
388 /*const*/ void* args[] = { &d1, &d2 };
389 FFI_CALL(cif,d_d2,args,&dr);
390 }
391 }
392 fprintf(out,"->%g\n",dr);
393 fflush(out);
394 #endif
395
396 #if (!defined(DGTEST)) || DGTEST == 16
397 dr = d_d4(d1,d2,d3,d4);
398 fprintf(out,"->%g\n",dr);
399 fflush(out);
400 dr = 0.0; clear_traces();
401 {
402 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double };
403 ffi_cif cif;
404 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
405 {
406 /*const*/ void* args[] = { &d1, &d2, &d3, &d4 };
407 FFI_CALL(cif,d_d4,args,&dr);
408 }
409 }
410 fprintf(out,"->%g\n",dr);
411 fflush(out);
412 #endif
413
414 #if (!defined(DGTEST)) || DGTEST == 17
415 dr = d_d8(d1,d2,d3,d4,d5,d6,d7,d8);
416 fprintf(out,"->%g\n",dr);
417 fflush(out);
418 dr = 0.0; clear_traces();
419 {
420 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double };
421 ffi_cif cif;
422 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
423 {
424 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8 };
425 FFI_CALL(cif,d_d8,args,&dr);
426 }
427 }
428 fprintf(out,"->%g\n",dr);
429 fflush(out);
430 #endif
431
432 #if (!defined(DGTEST)) || DGTEST == 18
433 dr = d_d16(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16);
434 fprintf(out,"->%g\n",dr);
435 fflush(out);
436 dr = 0.0; clear_traces();
437 {
438 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double };
439 ffi_cif cif;
440 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
441 {
442 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9, &d10, &d11, &d12, &d13, &d14, &d15, &d16 };
443 FFI_CALL(cif,d_d16,args,&dr);
444 }
445 }
446 fprintf(out,"->%g\n",dr);
447 fflush(out);
448 #endif
449 return;
450 }
451 void
pointer_tests(void)452 pointer_tests (void)
453 {
454 void* vpr;
455
456 #if (!defined(DGTEST)) || DGTEST == 19
457 vpr = vp_vpdpcpsp(&uc1,&d2,str3,&I4);
458 fprintf(out,"->0x%p\n",vpr);
459 fflush(out);
460 vpr = 0; clear_traces();
461 {
462 ffi_type* argtypes[] = { &ffi_type_pointer, &ffi_type_pointer, &ffi_type_pointer, &ffi_type_pointer };
463 ffi_cif cif;
464 FFI_PREP_CIF(cif,argtypes,ffi_type_pointer);
465 {
466 void* puc1 = &uc1;
467 void* pd2 = &d2;
468 void* pstr3 = str3;
469 void* pI4 = &I4;
470 /*const*/ void* args[] = { &puc1, &pd2, &pstr3, &pI4 };
471 FFI_CALL(cif,vp_vpdpcpsp,args,&vpr);
472 }
473 }
474 fprintf(out,"->0x%p\n",vpr);
475 fflush(out);
476 #endif
477 return;
478 }
479 void
mixed_number_tests(void)480 mixed_number_tests (void)
481 {
482 uchar ucr;
483 ushort usr;
484 float fr;
485 double dr;
486 long long llr;
487
488 /* Unsigned types.
489 */
490 #if (!defined(DGTEST)) || DGTEST == 20
491 ucr = uc_ucsil(uc1, us2, ui3, ul4);
492 fprintf(out,"->%u\n",ucr);
493 fflush(out);
494 ucr = 0; clear_traces();
495 {
496 ffi_type* argtypes[] = { &ffi_type_uchar, &ffi_type_ushort, &ffi_type_uint, &ffi_type_ulong };
497 ffi_cif cif;
498 FFI_PREP_CIF(cif,argtypes,ffi_type_uchar);
499 {
500 ffi_arg r;
501 /*const*/ void* args[] = { &uc1, &us2, &ui3, &ul4 };
502 FFI_CALL(cif,uc_ucsil,args,&r);
503 ucr = (uchar) r;
504 }
505 }
506 fprintf(out,"->%u\n",ucr);
507 fflush(out);
508 #endif
509
510 #if (!defined(DGTEST)) || DGTEST == 21
511 /* Mixed int & float types.
512 */
513 dr = d_iidd(i1,i2,d3,d4);
514 fprintf(out,"->%g\n",dr);
515 fflush(out);
516 dr = 0.0; clear_traces();
517 {
518 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_double, &ffi_type_double };
519 ffi_cif cif;
520 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
521 {
522 /*const*/ void* args[] = { &i1, &i2, &d3, &d4 };
523 FFI_CALL(cif,d_iidd,args,&dr);
524 }
525 }
526 fprintf(out,"->%g\n",dr);
527 fflush(out);
528 #endif
529
530 #if (!defined(DGTEST)) || DGTEST == 22
531 dr = d_iiidi(i1,i2,i3,d4,i5);
532 fprintf(out,"->%g\n",dr);
533 fflush(out);
534 dr = 0.0; clear_traces();
535 {
536 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_double, &ffi_type_sint };
537 ffi_cif cif;
538 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
539 {
540 /*const*/ void* args[] = { &i1, &i2, &i3, &d4, &i5 };
541 FFI_CALL(cif,d_iiidi,args,&dr);
542 }
543 }
544 fprintf(out,"->%g\n",dr);
545 fflush(out);
546 #endif
547
548 #if (!defined(DGTEST)) || DGTEST == 23
549 dr = d_idid(i1,d2,i3,d4);
550 fprintf(out,"->%g\n",dr);
551 fflush(out);
552 dr = 0.0; clear_traces();
553 {
554 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_double, &ffi_type_sint, &ffi_type_double };
555 ffi_cif cif;
556 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
557 {
558 /*const*/ void* args[] = { &i1, &d2, &i3, &d4 };
559 FFI_CALL(cif,d_idid,args,&dr);
560 }
561 }
562 fprintf(out,"->%g\n",dr);
563 fflush(out);
564 #endif
565
566 #if (!defined(DGTEST)) || DGTEST == 24
567 dr = d_fdi(f1,d2,i3);
568 fprintf(out,"->%g\n",dr);
569 fflush(out);
570 dr = 0.0; clear_traces();
571 {
572 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_double, &ffi_type_sint };
573 ffi_cif cif;
574 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
575 {
576 /*const*/ void* args[] = { &f1, &d2, &i3 };
577 FFI_CALL(cif,d_fdi,args,&dr);
578 }
579 }
580 fprintf(out,"->%g\n",dr);
581 fflush(out);
582 #endif
583
584 #if (!defined(DGTEST)) || DGTEST == 25
585 usr = us_cdcd(c1,d2,c3,d4);
586 fprintf(out,"->%u\n",usr);
587 fflush(out);
588 usr = 0; clear_traces();
589 {
590 ffi_type* argtypes[] = { &ffi_type_char, &ffi_type_double, &ffi_type_char, &ffi_type_double };
591 ffi_cif cif;
592 FFI_PREP_CIF(cif,argtypes,ffi_type_ushort);
593 {
594 ffi_arg rint;
595 /*const*/ void* args[] = { &c1, &d2, &c3, &d4 };
596 FFI_CALL(cif,us_cdcd,args,&rint);
597 usr = (ushort) rint;
598 }
599 }
600 fprintf(out,"->%u\n",usr);
601 fflush(out);
602 #endif
603
604 #if (!defined(DGTEST)) || DGTEST == 26
605 /* Long long types.
606 */
607 llr = ll_iiilli(i1,i2,i3,ll1,i13);
608 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
609 fflush(out);
610 llr = 0; clear_traces();
611 {
612 ffi_type* argtypes[] = { &ffi_type_sint, &ffi_type_sint, &ffi_type_sint, &ffi_type_slonglong, &ffi_type_sint };
613 ffi_cif cif;
614 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
615 {
616 /*const*/ void* args[] = { &i1, &i2, &i3, &ll1, &i13 };
617 FFI_CALL(cif,ll_iiilli,args,&llr);
618 }
619 }
620 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
621 fflush(out);
622 #endif
623
624 #if (!defined(DGTEST)) || DGTEST == 27
625 llr = ll_flli(f13,ll1,i13);
626 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
627 fflush(out);
628 llr = 0; clear_traces();
629 {
630 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_slonglong, &ffi_type_sint };
631 ffi_cif cif;
632 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
633 {
634 /*const*/ void* args[] = { &f13, &ll1, &i13 };
635 FFI_CALL(cif,ll_flli,args,&llr);
636 }
637 }
638 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
639 fflush(out);
640 #endif
641
642 #if (!defined(DGTEST)) || DGTEST == 28
643 fr = f_fi(f1,i9);
644 fprintf(out,"->%g\n",fr);
645 fflush(out);
646 fr = 0.0; clear_traces();
647 {
648 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_sint };
649 ffi_cif cif;
650 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
651 {
652 /*const*/ void* args[] = { &f1, &i9 };
653 FFI_CALL(cif,f_fi,args,&fr);
654 }
655 }
656 fprintf(out,"->%g\n",fr);
657 fflush(out);
658 #endif
659
660 #if (!defined(DGTEST)) || DGTEST == 29
661 fr = f_f2i(f1,f2,i9);
662 fprintf(out,"->%g\n",fr);
663 fflush(out);
664 fr = 0.0; clear_traces();
665 {
666 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_sint };
667 ffi_cif cif;
668 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
669 {
670 /*const*/ void* args[] = { &f1, &f2, &i9 };
671 FFI_CALL(cif,f_f2i,args,&fr);
672 }
673 }
674 fprintf(out,"->%g\n",fr);
675 fflush(out);
676 #endif
677
678 #if (!defined(DGTEST)) || DGTEST == 30
679 fr = f_f3i(f1,f2,f3,i9);
680 fprintf(out,"->%g\n",fr);
681 fflush(out);
682 fr = 0.0; clear_traces();
683 {
684 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
685 ffi_cif cif;
686 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
687 {
688 /*const*/ void* args[] = { &f1, &f2, &f3, &i9 };
689 FFI_CALL(cif,f_f3i,args,&fr);
690 }
691 }
692 fprintf(out,"->%g\n",fr);
693 fflush(out);
694 #endif
695
696 #if (!defined(DGTEST)) || DGTEST == 31
697 fr = f_f4i(f1,f2,f3,f4,i9);
698 fprintf(out,"->%g\n",fr);
699 fflush(out);
700 fr = 0.0; clear_traces();
701 {
702 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
703 ffi_cif cif;
704 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
705 {
706 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &i9 };
707 FFI_CALL(cif,f_f4i,args,&fr);
708 }
709 }
710 fprintf(out,"->%g\n",fr);
711 fflush(out);
712 #endif
713
714 #if (!defined(DGTEST)) || DGTEST == 32
715 fr = f_f7i(f1,f2,f3,f4,f5,f6,f7,i9);
716 fprintf(out,"->%g\n",fr);
717 fflush(out);
718 fr = 0.0; clear_traces();
719 {
720 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
721 ffi_cif cif;
722 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
723 {
724 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &i9 };
725 FFI_CALL(cif,f_f7i,args,&fr);
726 }
727 }
728 fprintf(out,"->%g\n",fr);
729 fflush(out);
730 #endif
731
732 #if (!defined(DGTEST)) || DGTEST == 33
733 fr = f_f8i(f1,f2,f3,f4,f5,f6,f7,f8,i9);
734 fprintf(out,"->%g\n",fr);
735 fflush(out);
736 fr = 0.0; clear_traces();
737 {
738 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
739 ffi_cif cif;
740 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
741 {
742 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &i9 };
743 FFI_CALL(cif,f_f8i,args,&fr);
744 }
745 }
746 fprintf(out,"->%g\n",fr);
747 fflush(out);
748 #endif
749
750 #if (!defined(DGTEST)) || DGTEST == 34
751 fr = f_f12i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,i9);
752 fprintf(out,"->%g\n",fr);
753 fflush(out);
754 fr = 0.0; clear_traces();
755 {
756 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
757 ffi_cif cif;
758 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
759 {
760 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9, &f10, &f11, &f12, &i9 };
761 FFI_CALL(cif,f_f12i,args,&fr);
762 }
763 }
764 fprintf(out,"->%g\n",fr);
765 fflush(out);
766 #endif
767
768 #if (!defined(DGTEST)) || DGTEST == 35
769 fr = f_f13i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9);
770 fprintf(out,"->%g\n",fr);
771 fflush(out);
772 fr = 0.0; clear_traces();
773 {
774 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_sint };
775 ffi_cif cif;
776 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
777 {
778 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9, &f10, &f11, &f12, &f13, &i9 };
779 FFI_CALL(cif,f_f13i,args,&fr);
780 }
781 }
782 fprintf(out,"->%g\n",fr);
783 fflush(out);
784 #endif
785
786 #if (!defined(DGTEST)) || DGTEST == 36
787 dr = d_di(d1,i9);
788 fprintf(out,"->%g\n",dr);
789 fflush(out);
790 dr = 0.0; clear_traces();
791 {
792 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_sint };
793 ffi_cif cif;
794 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
795 {
796 /*const*/ void* args[] = { &d1, &i9 };
797 FFI_CALL(cif,d_di,args,&dr);
798 }
799 }
800 fprintf(out,"->%g\n",dr);
801 fflush(out);
802 #endif
803
804 #if (!defined(DGTEST)) || DGTEST == 37
805 dr = d_d2i(d1,d2,i9);
806 fprintf(out,"->%g\n",dr);
807 fflush(out);
808 dr = 0.0; clear_traces();
809 {
810 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_sint };
811 ffi_cif cif;
812 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
813 {
814 /*const*/ void* args[] = { &d1, &d2, &i9 };
815 FFI_CALL(cif,d_d2i,args,&dr);
816 }
817 }
818 fprintf(out,"->%g\n",dr);
819 fflush(out);
820 #endif
821
822 #if (!defined(DGTEST)) || DGTEST == 38
823 dr = d_d3i(d1,d2,d3,i9);
824 fprintf(out,"->%g\n",dr);
825 fflush(out);
826 dr = 0.0; clear_traces();
827 {
828 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
829 ffi_cif cif;
830 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
831 {
832 /*const*/ void* args[] = { &d1, &d2, &d3, &i9 };
833 FFI_CALL(cif,d_d3i,args,&dr);
834 }
835 }
836 fprintf(out,"->%g\n",dr);
837 fflush(out);
838 #endif
839
840 #if (!defined(DGTEST)) || DGTEST == 39
841 dr = d_d4i(d1,d2,d3,d4,i9);
842 fprintf(out,"->%g\n",dr);
843 fflush(out);
844 dr = 0.0; clear_traces();
845 {
846 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
847 ffi_cif cif;
848 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
849 {
850 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &i9 };
851 FFI_CALL(cif,d_d4i,args,&dr);
852 }
853 }
854 fprintf(out,"->%g\n",dr);
855 fflush(out);
856 #endif
857
858 #if (!defined(DGTEST)) || DGTEST == 40
859 dr = d_d7i(d1,d2,d3,d4,d5,d6,d7,i9);
860 fprintf(out,"->%g\n",dr);
861 fflush(out);
862 dr = 0.0; clear_traces();
863 {
864 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
865 ffi_cif cif;
866 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
867 {
868 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &i9 };
869 FFI_CALL(cif,d_d7i,args,&dr);
870 }
871 }
872 fprintf(out,"->%g\n",dr);
873 fflush(out);
874 #endif
875
876 #if (!defined(DGTEST)) || DGTEST == 41
877 dr = d_d8i(d1,d2,d3,d4,d5,d6,d7,d8,i9);
878 fprintf(out,"->%g\n",dr);
879 fflush(out);
880 dr = 0.0; clear_traces();
881 {
882 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
883 ffi_cif cif;
884 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
885 {
886 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &i9 };
887 FFI_CALL(cif,d_d8i,args,&dr);
888 }
889 }
890 fprintf(out,"->%g\n",dr);
891 fflush(out);
892 #endif
893
894 #if (!defined(DGTEST)) || DGTEST == 42
895 dr = d_d12i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9);
896 fprintf(out,"->%g\n",dr);
897 fflush(out);
898 dr = 0.0; clear_traces();
899 {
900 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
901 ffi_cif cif;
902 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
903 {
904 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9, &d10, &d11, &d12, &i9 };
905 FFI_CALL(cif,d_d12i,args,&dr);
906 }
907 }
908 fprintf(out,"->%g\n",dr);
909 fflush(out);
910 #endif
911
912 #if (!defined(DGTEST)) || DGTEST == 43
913 dr = d_d13i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9);
914 fprintf(out,"->%g\n",dr);
915 fflush(out);
916 dr = 0.0; clear_traces();
917 {
918 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_sint };
919 ffi_cif cif;
920 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
921 {
922 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9, &d10, &d11, &d12, &d13, &i9 };
923 FFI_CALL(cif,d_d13i,args,&dr);
924 }
925 }
926 fprintf(out,"->%g\n",dr);
927 fflush(out);
928 #endif
929 return;
930 }
931 void
small_structure_return_tests(void)932 small_structure_return_tests (void)
933 {
934 #if (!defined(DGTEST)) || DGTEST == 44
935 {
936 Size1 r = S1_v();
937 fprintf(out,"->{%c}\n",r.x1);
938 fflush(out);
939 memset(&r,0,sizeof(r)); clear_traces();
940 {
941 ffi_type* ffi_type_Size1_elements[] = { &ffi_type_char, NULL };
942 ffi_type ffi_type_Size1;
943 ffi_type_Size1.type = FFI_TYPE_STRUCT;
944 ffi_type_Size1.size = sizeof(Size1);
945 ffi_type_Size1.alignment = alignof_slot(Size1);
946 ffi_type_Size1.elements = ffi_type_Size1_elements;
947 ffi_cif cif;
948 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size1);
949 {
950 FFI_CALL(cif,S1_v,NULL,&r);
951 }
952 }
953 fprintf(out,"->{%c}\n",r.x1);
954 fflush(out);
955 }
956 #endif
957 #if (!defined(DGTEST)) || DGTEST == 45
958 {
959 Size2 r = S2_v();
960 fprintf(out,"->{%c%c}\n",r.x1,r.x2);
961 fflush(out);
962 memset(&r,0,sizeof(r)); clear_traces();
963 {
964 ffi_type* ffi_type_Size2_elements[] = { &ffi_type_char, &ffi_type_char, NULL };
965 ffi_type ffi_type_Size2;
966 ffi_type_Size2.type = FFI_TYPE_STRUCT;
967 ffi_type_Size2.size = sizeof(Size2);
968 ffi_type_Size2.alignment = alignof_slot(Size2);
969 ffi_type_Size2.elements = ffi_type_Size2_elements;
970 ffi_cif cif;
971 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size2);
972 {
973 FFI_CALL(cif,S2_v,NULL,&r);
974 }
975 }
976 fprintf(out,"->{%c%c}\n",r.x1,r.x2);
977 fflush(out);
978 }
979 #endif
980 #if (!defined(DGTEST)) || DGTEST == 46
981 {
982 Size3 r = S3_v();
983 fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3);
984 fflush(out);
985 memset(&r,0,sizeof(r)); clear_traces();
986 {
987 ffi_type* ffi_type_Size3_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
988 ffi_type ffi_type_Size3;
989 ffi_type_Size3.type = FFI_TYPE_STRUCT;
990 ffi_type_Size3.size = sizeof(Size3);
991 ffi_type_Size3.alignment = alignof_slot(Size3);
992 ffi_type_Size3.elements = ffi_type_Size3_elements;
993 ffi_cif cif;
994 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size3);
995 {
996 FFI_CALL(cif,S3_v,NULL,&r);
997 }
998 }
999 fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3);
1000 fflush(out);
1001 }
1002 #endif
1003 #if (!defined(DGTEST)) || DGTEST == 47
1004 {
1005 Size4 r = S4_v();
1006 fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4);
1007 fflush(out);
1008 memset(&r,0,sizeof(r)); clear_traces();
1009 {
1010 ffi_type* ffi_type_Size4_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
1011 ffi_type ffi_type_Size4;
1012 ffi_type_Size4.type = FFI_TYPE_STRUCT;
1013 ffi_type_Size4.size = sizeof(Size4);
1014 ffi_type_Size4.alignment = alignof_slot(Size4);
1015 ffi_type_Size4.elements = ffi_type_Size4_elements;
1016 ffi_cif cif;
1017 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size4);
1018 {
1019 FFI_CALL(cif,S4_v,NULL,&r);
1020 }
1021 }
1022 fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4);
1023 fflush(out);
1024 }
1025 #endif
1026 #if (!defined(DGTEST)) || DGTEST == 48
1027 {
1028 Size7 r = S7_v();
1029 fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7);
1030 fflush(out);
1031 memset(&r,0,sizeof(r)); clear_traces();
1032 {
1033 ffi_type* ffi_type_Size7_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
1034 ffi_type ffi_type_Size7;
1035 ffi_type_Size7.type = FFI_TYPE_STRUCT;
1036 ffi_type_Size7.size = sizeof(Size7);
1037 ffi_type_Size7.alignment = alignof_slot(Size7);
1038 ffi_type_Size7.elements = ffi_type_Size7_elements;
1039 ffi_cif cif;
1040 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size7);
1041 {
1042 FFI_CALL(cif,S7_v,NULL,&r);
1043 }
1044 }
1045 fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7);
1046 fflush(out);
1047 }
1048 #endif
1049 #if (!defined(DGTEST)) || DGTEST == 49
1050 {
1051 Size8 r = S8_v();
1052 fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8);
1053 fflush(out);
1054 memset(&r,0,sizeof(r)); clear_traces();
1055 {
1056 ffi_type* ffi_type_Size8_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
1057 ffi_type ffi_type_Size8;
1058 ffi_type_Size8.type = FFI_TYPE_STRUCT;
1059 ffi_type_Size8.size = sizeof(Size8);
1060 ffi_type_Size8.alignment = alignof_slot(Size8);
1061 ffi_type_Size8.elements = ffi_type_Size8_elements;
1062 ffi_cif cif;
1063 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size8);
1064 {
1065 FFI_CALL(cif,S8_v,NULL,&r);
1066 }
1067 }
1068 fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8);
1069 fflush(out);
1070 }
1071 #endif
1072 #if (!defined(DGTEST)) || DGTEST == 50
1073 {
1074 Size12 r = S12_v();
1075 fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12);
1076 fflush(out);
1077 memset(&r,0,sizeof(r)); clear_traces();
1078 {
1079 ffi_type* ffi_type_Size12_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
1080 ffi_type ffi_type_Size12;
1081 ffi_type_Size12.type = FFI_TYPE_STRUCT;
1082 ffi_type_Size12.size = sizeof(Size12);
1083 ffi_type_Size12.alignment = alignof_slot(Size12);
1084 ffi_type_Size12.elements = ffi_type_Size12_elements;
1085 ffi_cif cif;
1086 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size12);
1087 {
1088 FFI_CALL(cif,S12_v,NULL,&r);
1089 }
1090 }
1091 fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12);
1092 fflush(out);
1093 }
1094 #endif
1095 #if (!defined(DGTEST)) || DGTEST == 51
1096 {
1097 Size15 r = S15_v();
1098 fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15);
1099 fflush(out);
1100 memset(&r,0,sizeof(r)); clear_traces();
1101 {
1102 ffi_type* ffi_type_Size15_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
1103 ffi_type ffi_type_Size15;
1104 ffi_type_Size15.type = FFI_TYPE_STRUCT;
1105 ffi_type_Size15.size = sizeof(Size15);
1106 ffi_type_Size15.alignment = alignof_slot(Size15);
1107 ffi_type_Size15.elements = ffi_type_Size15_elements;
1108 ffi_cif cif;
1109 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size15);
1110 {
1111 FFI_CALL(cif,S15_v,NULL,&r);
1112 }
1113 }
1114 fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15);
1115 fflush(out);
1116 }
1117 #endif
1118 #if (!defined(DGTEST)) || DGTEST == 52
1119 {
1120 Size16 r = S16_v();
1121 fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16);
1122 fflush(out);
1123 memset(&r,0,sizeof(r)); clear_traces();
1124 {
1125 ffi_type* ffi_type_Size16_elements[] = { &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, &ffi_type_char, NULL };
1126 ffi_type ffi_type_Size16;
1127 ffi_type_Size16.type = FFI_TYPE_STRUCT;
1128 ffi_type_Size16.size = sizeof(Size16);
1129 ffi_type_Size16.alignment = alignof_slot(Size16);
1130 ffi_type_Size16.elements = ffi_type_Size16_elements;
1131 ffi_cif cif;
1132 FFI_PREP_CIF_NOARGS(cif,ffi_type_Size16);
1133 {
1134 FFI_CALL(cif,S16_v,NULL,&r);
1135 }
1136 }
1137 fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16);
1138 fflush(out);
1139 }
1140 #endif
1141 }
1142 void
structure_tests(void)1143 structure_tests (void)
1144 {
1145 Int Ir;
1146 Char Cr;
1147 Float Fr;
1148 Double Dr;
1149 J Jr;
1150 #ifndef SKIP_EXTRA_STRUCTS
1151 T Tr;
1152 X Xr;
1153 #endif
1154
1155 #if (!defined(DGTEST)) || DGTEST == 53
1156 Ir = I_III(I1,I2,I3);
1157 fprintf(out,"->{%d}\n",Ir.x);
1158 fflush(out);
1159 Ir.x = 0; clear_traces();
1160 {
1161 ffi_type* ffi_type_Int_elements[] = { &ffi_type_sint, NULL };
1162 ffi_type ffi_type_Int;
1163 ffi_type_Int.type = FFI_TYPE_STRUCT;
1164 ffi_type_Int.size = sizeof(Int);
1165 ffi_type_Int.alignment = alignof_slot(Int);
1166 ffi_type_Int.elements = ffi_type_Int_elements;
1167 ffi_type* argtypes[] = { &ffi_type_Int, &ffi_type_Int, &ffi_type_Int };
1168 ffi_cif cif;
1169 FFI_PREP_CIF(cif,argtypes,ffi_type_Int);
1170 {
1171 /*const*/ void* args[] = { &I1, &I2, &I3 };
1172 FFI_CALL(cif,I_III,args,&Ir);
1173 }
1174 }
1175 fprintf(out,"->{%d}\n",Ir.x);
1176 fflush(out);
1177 #endif
1178 #if (!defined(DGTEST)) || DGTEST == 54
1179 Cr = C_CdC(C1,d2,C3);
1180 fprintf(out,"->{'%c'}\n",Cr.x);
1181 fflush(out);
1182 Cr.x = '\0'; clear_traces();
1183 {
1184 ffi_type* ffi_type_Char_elements[] = { &ffi_type_char, NULL };
1185 ffi_type ffi_type_Char;
1186 ffi_type_Char.type = FFI_TYPE_STRUCT;
1187 ffi_type_Char.size = sizeof(Char);
1188 ffi_type_Char.alignment = alignof_slot(Char);
1189 ffi_type_Char.elements = ffi_type_Char_elements;
1190 ffi_type* argtypes[] = { &ffi_type_Char, &ffi_type_double, &ffi_type_Char };
1191 ffi_cif cif;
1192 FFI_PREP_CIF(cif,argtypes,ffi_type_Char);
1193 {
1194 /*const*/ void* args[] = { &C1, &d2, &C3 };
1195 FFI_CALL(cif,C_CdC,args,&Cr);
1196 }
1197 }
1198 fprintf(out,"->{'%c'}\n",Cr.x);
1199 fflush(out);
1200 #endif
1201 #if (!defined(DGTEST)) || DGTEST == 55
1202 Fr = F_Ffd(F1,f2,d3);
1203 fprintf(out,"->{%g}\n",Fr.x);
1204 fflush(out);
1205 Fr.x = 0.0; clear_traces();
1206 {
1207 ffi_type* ffi_type_Float_elements[] = { &ffi_type_float, NULL };
1208 ffi_type ffi_type_Float;
1209 ffi_type_Float.type = FFI_TYPE_STRUCT;
1210 ffi_type_Float.size = sizeof(Float);
1211 ffi_type_Float.alignment = alignof_slot(Float);
1212 ffi_type_Float.elements = ffi_type_Float_elements;
1213 ffi_type* argtypes[] = { &ffi_type_Float, &ffi_type_float, &ffi_type_double };
1214 ffi_cif cif;
1215 FFI_PREP_CIF(cif,argtypes,ffi_type_Float);
1216 {
1217 /*const*/ void* args[] = { &F1, &f2, &d3 };
1218 FFI_CALL(cif,F_Ffd,args,&Fr);
1219 }
1220 }
1221 fprintf(out,"->{%g}\n",Fr.x);
1222 fflush(out);
1223 #endif
1224 #if (!defined(DGTEST)) || DGTEST == 56
1225 Dr = D_fDd(f1,D2,d3);
1226 fprintf(out,"->{%g}\n",Dr.x);
1227 fflush(out);
1228 Dr.x = 0.0; clear_traces();
1229 {
1230 ffi_type* ffi_type_Double_elements[] = { &ffi_type_double, NULL };
1231 ffi_type ffi_type_Double;
1232 ffi_type_Double.type = FFI_TYPE_STRUCT;
1233 ffi_type_Double.size = sizeof(Double);
1234 ffi_type_Double.alignment = alignof_slot(Double);
1235 ffi_type_Double.elements = ffi_type_Double_elements;
1236 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_Double, &ffi_type_double };
1237 ffi_cif cif;
1238 FFI_PREP_CIF(cif,argtypes,ffi_type_Double);
1239 {
1240 /*const*/ void* args[] = { &f1, &D2, &d3 };
1241 FFI_CALL(cif,D_fDd,args,&Dr);
1242 }
1243 }
1244 fprintf(out,"->{%g}\n",Dr.x);
1245 fflush(out);
1246 #endif
1247 #if (!defined(DGTEST)) || DGTEST == 57
1248 Dr = D_Dfd(D1,f2,d3);
1249 fprintf(out,"->{%g}\n",Dr.x);
1250 fflush(out);
1251 Dr.x = 0.0; clear_traces();
1252 {
1253 ffi_type* ffi_type_Double_elements[] = { &ffi_type_double, NULL };
1254 ffi_type ffi_type_Double;
1255 ffi_type_Double.type = FFI_TYPE_STRUCT;
1256 ffi_type_Double.size = sizeof(Double);
1257 ffi_type_Double.alignment = alignof_slot(Double);
1258 ffi_type_Double.elements = ffi_type_Double_elements;
1259 ffi_type* argtypes[] = { &ffi_type_Double, &ffi_type_float, &ffi_type_double };
1260 ffi_cif cif;
1261 FFI_PREP_CIF(cif,argtypes,ffi_type_Double);
1262 {
1263 /*const*/ void* args[] = { &D1, &f2, &d3 };
1264 FFI_CALL(cif,D_Dfd,args,&Dr);
1265 }
1266 }
1267 fprintf(out,"->{%g}\n",Dr.x);
1268 fflush(out);
1269 #endif
1270 #if (!defined(DGTEST)) || DGTEST == 58
1271 Jr = J_JiJ(J1,i2,J2);
1272 fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2);
1273 fflush(out);
1274 Jr.l1 = Jr.l2 = 0; clear_traces();
1275 {
1276 ffi_type* ffi_type_J_elements[] = { &ffi_type_slong, &ffi_type_slong, NULL };
1277 ffi_type ffi_type_J;
1278 ffi_type_J.type = FFI_TYPE_STRUCT;
1279 ffi_type_J.size = sizeof(J);
1280 ffi_type_J.alignment = alignof_slot(J);
1281 ffi_type_J.elements = ffi_type_J_elements;
1282 ffi_type* argtypes[] = { &ffi_type_J, &ffi_type_sint, &ffi_type_J };
1283 ffi_cif cif;
1284 FFI_PREP_CIF(cif,argtypes,ffi_type_J);
1285 {
1286 /*const*/ void* args[] = { &J1, &i2, &J2 };
1287 FFI_CALL(cif,J_JiJ,args,&Jr);
1288 }
1289 }
1290 fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2);
1291 fflush(out);
1292 #endif
1293 #ifndef SKIP_EXTRA_STRUCTS
1294 #if (!defined(DGTEST)) || DGTEST == 59
1295 Tr = T_TcT(T1,' ',T2);
1296 fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]);
1297 fflush(out);
1298 Tr.c[0] = Tr.c[1] = Tr.c[2] = 0; clear_traces();
1299 {
1300 ffi_type* ffi_type_T_elements[] = { ??, NULL };
1301 ffi_type ffi_type_T;
1302 ffi_type_T.type = FFI_TYPE_STRUCT;
1303 ffi_type_T.size = sizeof(T);
1304 ffi_type_T.alignment = alignof_slot(T);
1305 ffi_type_T.elements = ffi_type_T_elements;
1306 ffi_type* argtypes[] = { &ffi_type_T, &ffi_type_char, &ffi_type_T };
1307 ffi_cif cif;
1308 FFI_PREP_CIF(cif,argtypes,ffi_type_T);
1309 {
1310 char space = ' ';
1311 /*const*/ void* args[] = { &T1, &space, &T2 };
1312 FFI_CALL(cif,T_TcT,args,&Tr);
1313 }
1314 }
1315 fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]);
1316 fflush(out);
1317 #endif
1318 #if (!defined(DGTEST)) || DGTEST == 60
1319 Xr = X_BcdB(B1,c2,d3,B2);
1320 fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1);
1321 fflush(out);
1322 Xr.c[0]=Xr.c1='\0'; clear_traces();
1323 {
1324 ffi_type* ffi_type_X_elements[] = { ??, NULL };
1325 ffi_type ffi_type_X;
1326 ffi_type_X.type = FFI_TYPE_STRUCT;
1327 ffi_type_X.size = sizeof(X);
1328 ffi_type_X.alignment = alignof_slot(X);
1329 ffi_type_X.elements = ffi_type_X_elements;
1330 ffi_type* argtypes[] = { &ffi_type_X, &ffi_type_char, &ffi_type_double, &ffi_type_X };
1331 ffi_cif cif;
1332 FFI_PREP_CIF(cif,argtypes,ffi_type_X);
1333 {
1334 /*const*/ void* args[] = { &B1, &c2, &d3, &B2 };
1335 FFI_CALL(cif,X_BcdB,args,&Xr);
1336 }
1337 }
1338 fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1);
1339 fflush(out);
1340 #endif
1341 #endif
1342
1343 return;
1344 }
1345
1346 void
gpargs_boundary_tests(void)1347 gpargs_boundary_tests (void)
1348 {
1349 ffi_type* ffi_type_K_elements[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, NULL };
1350 ffi_type ffi_type_K;
1351 ffi_type* ffi_type_L_elements[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, NULL };
1352 ffi_type ffi_type_L;
1353 long lr;
1354 long long llr;
1355 float fr;
1356 double dr;
1357
1358 ffi_type_K.type = FFI_TYPE_STRUCT;
1359 ffi_type_K.size = sizeof(K);
1360 ffi_type_K.alignment = alignof_slot(K);
1361 ffi_type_K.elements = ffi_type_K_elements;
1362
1363 ffi_type_L.type = FFI_TYPE_STRUCT;
1364 ffi_type_L.size = sizeof(L);
1365 ffi_type_L.alignment = alignof_slot(L);
1366 ffi_type_L.elements = ffi_type_L_elements;
1367
1368 #if (!defined(DGTEST)) || DGTEST == 61
1369 lr = l_l0K(K1,l9);
1370 fprintf(out,"->%ld\n",lr);
1371 fflush(out);
1372 lr = 0; clear_traces();
1373 {
1374 ffi_type* argtypes[] = { &ffi_type_K, &ffi_type_slong };
1375 ffi_cif cif;
1376 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1377 {
1378 /*const*/ void* args[] = { &K1, &l9 };
1379 FFI_CALL(cif,l_l0K,args,&lr);
1380 }
1381 }
1382 fprintf(out,"->%ld\n",lr);
1383 fflush(out);
1384 #endif
1385 #if (!defined(DGTEST)) || DGTEST == 62
1386 lr = l_l1K(l1,K1,l9);
1387 fprintf(out,"->%ld\n",lr);
1388 fflush(out);
1389 lr = 0; clear_traces();
1390 {
1391 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
1392 ffi_cif cif;
1393 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1394 {
1395 /*const*/ void* args[] = { &l1, &K1, &l9 };
1396 FFI_CALL(cif,l_l1K,args,&lr);
1397 }
1398 }
1399 fprintf(out,"->%ld\n",lr);
1400 fflush(out);
1401 #endif
1402 #if (!defined(DGTEST)) || DGTEST == 63
1403 lr = l_l2K(l1,l2,K1,l9);
1404 fprintf(out,"->%ld\n",lr);
1405 fflush(out);
1406 lr = 0; clear_traces();
1407 {
1408 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
1409 ffi_cif cif;
1410 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1411 {
1412 /*const*/ void* args[] = { &l1, &l2, &K1, &l9 };
1413 FFI_CALL(cif,l_l2K,args,&lr);
1414 }
1415 }
1416 fprintf(out,"->%ld\n",lr);
1417 fflush(out);
1418 #endif
1419 #if (!defined(DGTEST)) || DGTEST == 64
1420 lr = l_l3K(l1,l2,l3,K1,l9);
1421 fprintf(out,"->%ld\n",lr);
1422 fflush(out);
1423 lr = 0; clear_traces();
1424 {
1425 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
1426 ffi_cif cif;
1427 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1428 {
1429 /*const*/ void* args[] = { &l1, &l2, &l3, &K1, &l9 };
1430 FFI_CALL(cif,l_l3K,args,&lr);
1431 }
1432 }
1433 fprintf(out,"->%ld\n",lr);
1434 fflush(out);
1435 #endif
1436 #if (!defined(DGTEST)) || DGTEST == 65
1437 lr = l_l4K(l1,l2,l3,l4,K1,l9);
1438 fprintf(out,"->%ld\n",lr);
1439 fflush(out);
1440 lr = 0; clear_traces();
1441 {
1442 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
1443 ffi_cif cif;
1444 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1445 {
1446 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &K1, &l9 };
1447 FFI_CALL(cif,l_l4K,args,&lr);
1448 }
1449 }
1450 fprintf(out,"->%ld\n",lr);
1451 fflush(out);
1452 #endif
1453 #if (!defined(DGTEST)) || DGTEST == 66
1454 lr = l_l5K(l1,l2,l3,l4,l5,K1,l9);
1455 fprintf(out,"->%ld\n",lr);
1456 fflush(out);
1457 lr = 0; clear_traces();
1458 {
1459 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
1460 ffi_cif cif;
1461 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1462 {
1463 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &K1, &l9 };
1464 FFI_CALL(cif,l_l5K,args,&lr);
1465 }
1466 }
1467 fprintf(out,"->%ld\n",lr);
1468 fflush(out);
1469 #endif
1470 #if (!defined(DGTEST)) || DGTEST == 67
1471 lr = l_l6K(l1,l2,l3,l4,l5,l6,K1,l9);
1472 fprintf(out,"->%ld\n",lr);
1473 fflush(out);
1474 lr = 0; clear_traces();
1475 {
1476 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_K, &ffi_type_slong };
1477 ffi_cif cif;
1478 FFI_PREP_CIF(cif,argtypes,ffi_type_slong);
1479 {
1480 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &l6, &K1, &l9 };
1481 FFI_CALL(cif,l_l6K,args,&lr);
1482 }
1483 }
1484 fprintf(out,"->%ld\n",lr);
1485 fflush(out);
1486 #endif
1487 #if (!defined(DGTEST)) || DGTEST == 68
1488 fr = f_f17l3L(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1);
1489 fprintf(out,"->%g\n",fr);
1490 fflush(out);
1491 fr = 0.0; clear_traces();
1492 {
1493 ffi_type* argtypes[] = { &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_float, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_L };
1494 ffi_cif cif;
1495 FFI_PREP_CIF(cif,argtypes,ffi_type_float);
1496 {
1497 /*const*/ void* args[] = { &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8, &f9, &f10, &f11, &f12, &f13, &f14, &f15, &f16, &f17, &l6, &l7, &l8, &L1 };
1498 FFI_CALL(cif,f_f17l3L,args,&fr);
1499 }
1500 }
1501 fprintf(out,"->%g\n",fr);
1502 fflush(out);
1503 #endif
1504 #if (!defined(DGTEST)) || DGTEST == 69
1505 dr = d_d17l3L(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1);
1506 fprintf(out,"->%g\n",dr);
1507 fflush(out);
1508 dr = 0.0; clear_traces();
1509 {
1510 ffi_type* argtypes[] = { &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_double, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_L };
1511 ffi_cif cif;
1512 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1513 {
1514 /*const*/ void* args[] = { &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9, &d10, &d11, &d12, &d13, &d14, &d15, &d16, &d17, &l6, &l7, &l8, &L1 };
1515 FFI_CALL(cif,d_d17l3L,args,&dr);
1516 }
1517 }
1518 fprintf(out,"->%g\n",dr);
1519 fflush(out);
1520 #endif
1521 #if (!defined(DGTEST)) || DGTEST == 70
1522 llr = ll_l2ll(l1,l2,ll1,l9);
1523 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1524 fflush(out);
1525 llr = 0; clear_traces();
1526 {
1527 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
1528 ffi_cif cif;
1529 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
1530 {
1531 /*const*/ void* args[] = { &l1, &l2, &ll1, &l9 };
1532 FFI_CALL(cif,ll_l2ll,args,&llr);
1533 }
1534 }
1535 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1536 fflush(out);
1537 #endif
1538 #if (!defined(DGTEST)) || DGTEST == 71
1539 llr = ll_l3ll(l1,l2,l3,ll1,l9);
1540 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1541 fflush(out);
1542 llr = 0; clear_traces();
1543 {
1544 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
1545 ffi_cif cif;
1546 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
1547 {
1548 /*const*/ void* args[] = { &l1, &l2, &l3, &ll1, &l9 };
1549 FFI_CALL(cif,ll_l3ll,args,&llr);
1550 }
1551 }
1552 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1553 fflush(out);
1554 #endif
1555 #if (!defined(DGTEST)) || DGTEST == 72
1556 llr = ll_l4ll(l1,l2,l3,l4,ll1,l9);
1557 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1558 fflush(out);
1559 llr = 0; clear_traces();
1560 {
1561 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
1562 ffi_cif cif;
1563 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
1564 {
1565 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &ll1, &l9 };
1566 FFI_CALL(cif,ll_l4ll,args,&llr);
1567 }
1568 }
1569 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1570 fflush(out);
1571 #endif
1572 #if (!defined(DGTEST)) || DGTEST == 73
1573 llr = ll_l5ll(l1,l2,l3,l4,l5,ll1,l9);
1574 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1575 fflush(out);
1576 llr = 0; clear_traces();
1577 {
1578 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
1579 ffi_cif cif;
1580 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
1581 {
1582 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &ll1, &l9 };
1583 FFI_CALL(cif,ll_l5ll,args,&llr);
1584 }
1585 }
1586 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1587 fflush(out);
1588 #endif
1589 #if (!defined(DGTEST)) || DGTEST == 74
1590 llr = ll_l6ll(l1,l2,l3,l4,l5,l6,ll1,l9);
1591 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1592 fflush(out);
1593 llr = 0; clear_traces();
1594 {
1595 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
1596 ffi_cif cif;
1597 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
1598 {
1599 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &l6, &ll1, &l9 };
1600 FFI_CALL(cif,ll_l6ll,args,&llr);
1601 }
1602 }
1603 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1604 fflush(out);
1605 #endif
1606 #if (!defined(DGTEST)) || DGTEST == 75
1607 llr = ll_l7ll(l1,l2,l3,l4,l5,l6,l7,ll1,l9);
1608 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1609 fflush(out);
1610 llr = 0; clear_traces();
1611 {
1612 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slonglong, &ffi_type_slong };
1613 ffi_cif cif;
1614 FFI_PREP_CIF(cif,argtypes,ffi_type_slonglong);
1615 {
1616 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &l6, &l7, &ll1, &l9 };
1617 FFI_CALL(cif,ll_l7ll,args,&llr);
1618 }
1619 }
1620 fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff));
1621 fflush(out);
1622 #endif
1623 #if (!defined(DGTEST)) || DGTEST == 76
1624 dr = d_l2d(l1,l2,d2,l9);
1625 fprintf(out,"->%g\n",dr);
1626 fflush(out);
1627 dr = 0.0; clear_traces();
1628 {
1629 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
1630 ffi_cif cif;
1631 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1632 {
1633 /*const*/ void* args[] = { &l1, &l2, &d2, &l9 };
1634 FFI_CALL(cif,d_l2d,args,&dr);
1635 }
1636 }
1637 fprintf(out,"->%g\n",dr);
1638 fflush(out);
1639 #endif
1640 #if (!defined(DGTEST)) || DGTEST == 77
1641 dr = d_l3d(l1,l2,l3,d2,l9);
1642 fprintf(out,"->%g\n",dr);
1643 fflush(out);
1644 dr = 0.0; clear_traces();
1645 {
1646 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
1647 ffi_cif cif;
1648 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1649 {
1650 /*const*/ void* args[] = { &l1, &l2, &l3, &d2, &l9 };
1651 FFI_CALL(cif,d_l3d,args,&dr);
1652 }
1653 }
1654 fprintf(out,"->%g\n",dr);
1655 fflush(out);
1656 #endif
1657 #if (!defined(DGTEST)) || DGTEST == 78
1658 dr = d_l4d(l1,l2,l3,l4,d2,l9);
1659 fprintf(out,"->%g\n",dr);
1660 fflush(out);
1661 dr = 0.0; clear_traces();
1662 {
1663 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
1664 ffi_cif cif;
1665 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1666 {
1667 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &d2, &l9 };
1668 FFI_CALL(cif,d_l4d,args,&dr);
1669 }
1670 }
1671 fprintf(out,"->%g\n",dr);
1672 fflush(out);
1673 #endif
1674 #if (!defined(DGTEST)) || DGTEST == 79
1675 dr = d_l5d(l1,l2,l3,l4,l5,d2,l9);
1676 fprintf(out,"->%g\n",dr);
1677 fflush(out);
1678 dr = 0.0; clear_traces();
1679 {
1680 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
1681 ffi_cif cif;
1682 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1683 {
1684 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &d2, &l9 };
1685 FFI_CALL(cif,d_l5d,args,&dr);
1686 }
1687 }
1688 fprintf(out,"->%g\n",dr);
1689 fflush(out);
1690 #endif
1691 #if (!defined(DGTEST)) || DGTEST == 80
1692 dr = d_l6d(l1,l2,l3,l4,l5,l6,d2,l9);
1693 fprintf(out,"->%g\n",dr);
1694 fflush(out);
1695 dr = 0.0; clear_traces();
1696 {
1697 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
1698 ffi_cif cif;
1699 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1700 {
1701 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &l6, &d2, &l9 };
1702 FFI_CALL(cif,d_l6d,args,&dr);
1703 }
1704 }
1705 fprintf(out,"->%g\n",dr);
1706 fflush(out);
1707 #endif
1708 #if (!defined(DGTEST)) || DGTEST == 81
1709 dr = d_l7d(l1,l2,l3,l4,l5,l6,l7,d2,l9);
1710 fprintf(out,"->%g\n",dr);
1711 fflush(out);
1712 dr = 0.0; clear_traces();
1713 {
1714 ffi_type* argtypes[] = { &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_slong, &ffi_type_double, &ffi_type_slong };
1715 ffi_cif cif;
1716 FFI_PREP_CIF(cif,argtypes,ffi_type_double);
1717 {
1718 /*const*/ void* args[] = { &l1, &l2, &l3, &l4, &l5, &l6, &l7, &d2, &l9 };
1719 FFI_CALL(cif,d_l7d,args,&dr);
1720 }
1721 }
1722 fprintf(out,"->%g\n",dr);
1723 fflush(out);
1724 #endif
1725 return;
1726 }
1727
1728 int
main(void)1729 main (void)
1730 {
1731 ffi_type_char = (char)(-1) < 0 ? ffi_type_schar : ffi_type_uchar;
1732 out = stdout;
1733
1734 void_tests();
1735 int_tests();
1736 float_tests();
1737 double_tests();
1738 pointer_tests();
1739 mixed_number_tests();
1740 small_structure_return_tests();
1741 structure_tests();
1742 gpargs_boundary_tests();
1743
1744 exit(0);
1745 }
1746