test-call.c 52 KB

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