| 1 | n/a | /* Area: ffi_call, closure_call |
|---|
| 2 | n/a | Purpose: Check large structure returns. |
|---|
| 3 | n/a | Limitations: none. |
|---|
| 4 | n/a | PR: none. |
|---|
| 5 | n/a | Originator: Blake Chaffin 6/18/2007 |
|---|
| 6 | n/a | */ |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ |
|---|
| 9 | n/a | /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ |
|---|
| 10 | n/a | /* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ |
|---|
| 11 | n/a | /* { dg-options -Wformat=0 { target moxie*-*-elf } } */ |
|---|
| 12 | n/a | /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ |
|---|
| 13 | n/a | |
|---|
| 14 | n/a | #include "ffitest.h" |
|---|
| 15 | n/a | |
|---|
| 16 | n/a | typedef struct BigStruct{ |
|---|
| 17 | n/a | uint8_t a; |
|---|
| 18 | n/a | int8_t b; |
|---|
| 19 | n/a | uint16_t c; |
|---|
| 20 | n/a | int16_t d; |
|---|
| 21 | n/a | uint32_t e; |
|---|
| 22 | n/a | int32_t f; |
|---|
| 23 | n/a | uint64_t g; |
|---|
| 24 | n/a | int64_t h; |
|---|
| 25 | n/a | float i; |
|---|
| 26 | n/a | double j; |
|---|
| 27 | n/a | long double k; |
|---|
| 28 | n/a | char* l; |
|---|
| 29 | n/a | uint8_t m; |
|---|
| 30 | n/a | int8_t n; |
|---|
| 31 | n/a | uint16_t o; |
|---|
| 32 | n/a | int16_t p; |
|---|
| 33 | n/a | uint32_t q; |
|---|
| 34 | n/a | int32_t r; |
|---|
| 35 | n/a | uint64_t s; |
|---|
| 36 | n/a | int64_t t; |
|---|
| 37 | n/a | float u; |
|---|
| 38 | n/a | double v; |
|---|
| 39 | n/a | long double w; |
|---|
| 40 | n/a | char* x; |
|---|
| 41 | n/a | uint8_t y; |
|---|
| 42 | n/a | int8_t z; |
|---|
| 43 | n/a | uint16_t aa; |
|---|
| 44 | n/a | int16_t bb; |
|---|
| 45 | n/a | uint32_t cc; |
|---|
| 46 | n/a | int32_t dd; |
|---|
| 47 | n/a | uint64_t ee; |
|---|
| 48 | n/a | int64_t ff; |
|---|
| 49 | n/a | float gg; |
|---|
| 50 | n/a | double hh; |
|---|
| 51 | n/a | long double ii; |
|---|
| 52 | n/a | char* jj; |
|---|
| 53 | n/a | uint8_t kk; |
|---|
| 54 | n/a | int8_t ll; |
|---|
| 55 | n/a | uint16_t mm; |
|---|
| 56 | n/a | int16_t nn; |
|---|
| 57 | n/a | uint32_t oo; |
|---|
| 58 | n/a | int32_t pp; |
|---|
| 59 | n/a | uint64_t qq; |
|---|
| 60 | n/a | int64_t rr; |
|---|
| 61 | n/a | float ss; |
|---|
| 62 | n/a | double tt; |
|---|
| 63 | n/a | long double uu; |
|---|
| 64 | n/a | char* vv; |
|---|
| 65 | n/a | uint8_t ww; |
|---|
| 66 | n/a | int8_t xx; |
|---|
| 67 | n/a | } BigStruct; |
|---|
| 68 | n/a | |
|---|
| 69 | n/a | BigStruct |
|---|
| 70 | n/a | test_large_fn( |
|---|
| 71 | n/a | uint8_t ui8_1, |
|---|
| 72 | n/a | int8_t si8_1, |
|---|
| 73 | n/a | uint16_t ui16_1, |
|---|
| 74 | n/a | int16_t si16_1, |
|---|
| 75 | n/a | uint32_t ui32_1, |
|---|
| 76 | n/a | int32_t si32_1, |
|---|
| 77 | n/a | uint64_t ui64_1, |
|---|
| 78 | n/a | int64_t si64_1, |
|---|
| 79 | n/a | float f_1, |
|---|
| 80 | n/a | double d_1, |
|---|
| 81 | n/a | long double ld_1, |
|---|
| 82 | n/a | char* p_1, |
|---|
| 83 | n/a | uint8_t ui8_2, |
|---|
| 84 | n/a | int8_t si8_2, |
|---|
| 85 | n/a | uint16_t ui16_2, |
|---|
| 86 | n/a | int16_t si16_2, |
|---|
| 87 | n/a | uint32_t ui32_2, |
|---|
| 88 | n/a | int32_t si32_2, |
|---|
| 89 | n/a | uint64_t ui64_2, |
|---|
| 90 | n/a | int64_t si64_2, |
|---|
| 91 | n/a | float f_2, |
|---|
| 92 | n/a | double d_2, |
|---|
| 93 | n/a | long double ld_2, |
|---|
| 94 | n/a | char* p_2, |
|---|
| 95 | n/a | uint8_t ui8_3, |
|---|
| 96 | n/a | int8_t si8_3, |
|---|
| 97 | n/a | uint16_t ui16_3, |
|---|
| 98 | n/a | int16_t si16_3, |
|---|
| 99 | n/a | uint32_t ui32_3, |
|---|
| 100 | n/a | int32_t si32_3, |
|---|
| 101 | n/a | uint64_t ui64_3, |
|---|
| 102 | n/a | int64_t si64_3, |
|---|
| 103 | n/a | float f_3, |
|---|
| 104 | n/a | double d_3, |
|---|
| 105 | n/a | long double ld_3, |
|---|
| 106 | n/a | char* p_3, |
|---|
| 107 | n/a | uint8_t ui8_4, |
|---|
| 108 | n/a | int8_t si8_4, |
|---|
| 109 | n/a | uint16_t ui16_4, |
|---|
| 110 | n/a | int16_t si16_4, |
|---|
| 111 | n/a | uint32_t ui32_4, |
|---|
| 112 | n/a | int32_t si32_4, |
|---|
| 113 | n/a | uint64_t ui64_4, |
|---|
| 114 | n/a | int64_t si64_4, |
|---|
| 115 | n/a | float f_4, |
|---|
| 116 | n/a | double d_4, |
|---|
| 117 | n/a | long double ld_4, |
|---|
| 118 | n/a | char* p_4, |
|---|
| 119 | n/a | uint8_t ui8_5, |
|---|
| 120 | n/a | int8_t si8_5) |
|---|
| 121 | n/a | { |
|---|
| 122 | n/a | BigStruct retVal = { |
|---|
| 123 | n/a | ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, |
|---|
| 124 | n/a | ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), |
|---|
| 125 | n/a | ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, |
|---|
| 126 | n/a | ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), |
|---|
| 127 | n/a | ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, |
|---|
| 128 | n/a | ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), |
|---|
| 129 | n/a | ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, |
|---|
| 130 | n/a | ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), |
|---|
| 131 | n/a | ui8_5 + 5, si8_5 + 5}; |
|---|
| 132 | n/a | |
|---|
| 133 | n/a | printf("%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 134 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 135 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 136 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 ": " |
|---|
| 137 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 138 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 139 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 140 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 "\n", |
|---|
| 141 | n/a | ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, (unsigned long)p_1, |
|---|
| 142 | n/a | ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, (unsigned long)p_2, |
|---|
| 143 | n/a | ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, (unsigned long)p_3, |
|---|
| 144 | n/a | ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, (unsigned long)p_4, ui8_5, si8_5, |
|---|
| 145 | n/a | retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, |
|---|
| 146 | n/a | retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, |
|---|
| 147 | n/a | retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, |
|---|
| 148 | n/a | retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, |
|---|
| 149 | n/a | retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, |
|---|
| 150 | n/a | retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, |
|---|
| 151 | n/a | retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, |
|---|
| 152 | n/a | retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); |
|---|
| 153 | n/a | |
|---|
| 154 | n/a | return retVal; |
|---|
| 155 | n/a | } |
|---|
| 156 | n/a | |
|---|
| 157 | n/a | static void |
|---|
| 158 | n/a | cls_large_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) |
|---|
| 159 | n/a | { |
|---|
| 160 | n/a | uint8_t ui8_1 = *(uint8_t*)args[0]; |
|---|
| 161 | n/a | int8_t si8_1 = *(int8_t*)args[1]; |
|---|
| 162 | n/a | uint16_t ui16_1 = *(uint16_t*)args[2]; |
|---|
| 163 | n/a | int16_t si16_1 = *(int16_t*)args[3]; |
|---|
| 164 | n/a | uint32_t ui32_1 = *(uint32_t*)args[4]; |
|---|
| 165 | n/a | int32_t si32_1 = *(int32_t*)args[5]; |
|---|
| 166 | n/a | uint64_t ui64_1 = *(uint64_t*)args[6]; |
|---|
| 167 | n/a | int64_t si64_1 = *(int64_t*)args[7]; |
|---|
| 168 | n/a | float f_1 = *(float*)args[8]; |
|---|
| 169 | n/a | double d_1 = *(double*)args[9]; |
|---|
| 170 | n/a | long double ld_1 = *(long double*)args[10]; |
|---|
| 171 | n/a | char* p_1 = *(char**)args[11]; |
|---|
| 172 | n/a | uint8_t ui8_2 = *(uint8_t*)args[12]; |
|---|
| 173 | n/a | int8_t si8_2 = *(int8_t*)args[13]; |
|---|
| 174 | n/a | uint16_t ui16_2 = *(uint16_t*)args[14]; |
|---|
| 175 | n/a | int16_t si16_2 = *(int16_t*)args[15]; |
|---|
| 176 | n/a | uint32_t ui32_2 = *(uint32_t*)args[16]; |
|---|
| 177 | n/a | int32_t si32_2 = *(int32_t*)args[17]; |
|---|
| 178 | n/a | uint64_t ui64_2 = *(uint64_t*)args[18]; |
|---|
| 179 | n/a | int64_t si64_2 = *(int64_t*)args[19]; |
|---|
| 180 | n/a | float f_2 = *(float*)args[20]; |
|---|
| 181 | n/a | double d_2 = *(double*)args[21]; |
|---|
| 182 | n/a | long double ld_2 = *(long double*)args[22]; |
|---|
| 183 | n/a | char* p_2 = *(char**)args[23]; |
|---|
| 184 | n/a | uint8_t ui8_3 = *(uint8_t*)args[24]; |
|---|
| 185 | n/a | int8_t si8_3 = *(int8_t*)args[25]; |
|---|
| 186 | n/a | uint16_t ui16_3 = *(uint16_t*)args[26]; |
|---|
| 187 | n/a | int16_t si16_3 = *(int16_t*)args[27]; |
|---|
| 188 | n/a | uint32_t ui32_3 = *(uint32_t*)args[28]; |
|---|
| 189 | n/a | int32_t si32_3 = *(int32_t*)args[29]; |
|---|
| 190 | n/a | uint64_t ui64_3 = *(uint64_t*)args[30]; |
|---|
| 191 | n/a | int64_t si64_3 = *(int64_t*)args[31]; |
|---|
| 192 | n/a | float f_3 = *(float*)args[32]; |
|---|
| 193 | n/a | double d_3 = *(double*)args[33]; |
|---|
| 194 | n/a | long double ld_3 = *(long double*)args[34]; |
|---|
| 195 | n/a | char* p_3 = *(char**)args[35]; |
|---|
| 196 | n/a | uint8_t ui8_4 = *(uint8_t*)args[36]; |
|---|
| 197 | n/a | int8_t si8_4 = *(int8_t*)args[37]; |
|---|
| 198 | n/a | uint16_t ui16_4 = *(uint16_t*)args[38]; |
|---|
| 199 | n/a | int16_t si16_4 = *(int16_t*)args[39]; |
|---|
| 200 | n/a | uint32_t ui32_4 = *(uint32_t*)args[40]; |
|---|
| 201 | n/a | int32_t si32_4 = *(int32_t*)args[41]; |
|---|
| 202 | n/a | uint64_t ui64_4 = *(uint64_t*)args[42]; |
|---|
| 203 | n/a | int64_t si64_4 = *(int64_t*)args[43]; |
|---|
| 204 | n/a | float f_4 = *(float*)args[44]; |
|---|
| 205 | n/a | double d_4 = *(double*)args[45]; |
|---|
| 206 | n/a | long double ld_4 = *(long double*)args[46]; |
|---|
| 207 | n/a | char* p_4 = *(char**)args[47]; |
|---|
| 208 | n/a | uint8_t ui8_5 = *(uint8_t*)args[48]; |
|---|
| 209 | n/a | int8_t si8_5 = *(int8_t*)args[49]; |
|---|
| 210 | n/a | |
|---|
| 211 | n/a | *(BigStruct*)resp = test_large_fn( |
|---|
| 212 | n/a | ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, |
|---|
| 213 | n/a | ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, |
|---|
| 214 | n/a | ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, |
|---|
| 215 | n/a | ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, p_4, |
|---|
| 216 | n/a | ui8_5, si8_5); |
|---|
| 217 | n/a | } |
|---|
| 218 | n/a | |
|---|
| 219 | n/a | int |
|---|
| 220 | n/a | main(int argc __UNUSED__, const char** argv __UNUSED__) |
|---|
| 221 | n/a | { |
|---|
| 222 | n/a | void *code; |
|---|
| 223 | n/a | ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); |
|---|
| 224 | n/a | |
|---|
| 225 | n/a | ffi_cif cif; |
|---|
| 226 | n/a | ffi_type* argTypes[51]; |
|---|
| 227 | n/a | void* argValues[51]; |
|---|
| 228 | n/a | |
|---|
| 229 | n/a | ffi_type ret_struct_type; |
|---|
| 230 | n/a | ffi_type* st_fields[51]; |
|---|
| 231 | n/a | BigStruct retVal; |
|---|
| 232 | n/a | |
|---|
| 233 | n/a | uint8_t ui8 = 1; |
|---|
| 234 | n/a | int8_t si8 = 2; |
|---|
| 235 | n/a | uint16_t ui16 = 3; |
|---|
| 236 | n/a | int16_t si16 = 4; |
|---|
| 237 | n/a | uint32_t ui32 = 5; |
|---|
| 238 | n/a | int32_t si32 = 6; |
|---|
| 239 | n/a | uint64_t ui64 = 7; |
|---|
| 240 | n/a | int64_t si64 = 8; |
|---|
| 241 | n/a | float f = 9; |
|---|
| 242 | n/a | double d = 10; |
|---|
| 243 | n/a | long double ld = 11; |
|---|
| 244 | n/a | char* p = (char*)0x12345678; |
|---|
| 245 | n/a | |
|---|
| 246 | n/a | memset (&retVal, 0, sizeof(retVal)); |
|---|
| 247 | n/a | |
|---|
| 248 | n/a | ret_struct_type.size = 0; |
|---|
| 249 | n/a | ret_struct_type.alignment = 0; |
|---|
| 250 | n/a | ret_struct_type.type = FFI_TYPE_STRUCT; |
|---|
| 251 | n/a | ret_struct_type.elements = st_fields; |
|---|
| 252 | n/a | |
|---|
| 253 | n/a | st_fields[0] = st_fields[12] = st_fields[24] = st_fields[36] = st_fields[48] = &ffi_type_uint8; |
|---|
| 254 | n/a | st_fields[1] = st_fields[13] = st_fields[25] = st_fields[37] = st_fields[49] = &ffi_type_sint8; |
|---|
| 255 | n/a | st_fields[2] = st_fields[14] = st_fields[26] = st_fields[38] = &ffi_type_uint16; |
|---|
| 256 | n/a | st_fields[3] = st_fields[15] = st_fields[27] = st_fields[39] = &ffi_type_sint16; |
|---|
| 257 | n/a | st_fields[4] = st_fields[16] = st_fields[28] = st_fields[40] = &ffi_type_uint32; |
|---|
| 258 | n/a | st_fields[5] = st_fields[17] = st_fields[29] = st_fields[41] = &ffi_type_sint32; |
|---|
| 259 | n/a | st_fields[6] = st_fields[18] = st_fields[30] = st_fields[42] = &ffi_type_uint64; |
|---|
| 260 | n/a | st_fields[7] = st_fields[19] = st_fields[31] = st_fields[43] = &ffi_type_sint64; |
|---|
| 261 | n/a | st_fields[8] = st_fields[20] = st_fields[32] = st_fields[44] = &ffi_type_float; |
|---|
| 262 | n/a | st_fields[9] = st_fields[21] = st_fields[33] = st_fields[45] = &ffi_type_double; |
|---|
| 263 | n/a | st_fields[10] = st_fields[22] = st_fields[34] = st_fields[46] = &ffi_type_longdouble; |
|---|
| 264 | n/a | st_fields[11] = st_fields[23] = st_fields[35] = st_fields[47] = &ffi_type_pointer; |
|---|
| 265 | n/a | |
|---|
| 266 | n/a | st_fields[50] = NULL; |
|---|
| 267 | n/a | |
|---|
| 268 | n/a | argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8; |
|---|
| 269 | n/a | argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8; |
|---|
| 270 | n/a | argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8; |
|---|
| 271 | n/a | argValues[1] = argValues[13] = argValues[25] = argValues[37] = argValues[49] = &si8; |
|---|
| 272 | n/a | argTypes[2] = argTypes[14] = argTypes[26] = argTypes[38] = &ffi_type_uint16; |
|---|
| 273 | n/a | argValues[2] = argValues[14] = argValues[26] = argValues[38] = &ui16; |
|---|
| 274 | n/a | argTypes[3] = argTypes[15] = argTypes[27] = argTypes[39] = &ffi_type_sint16; |
|---|
| 275 | n/a | argValues[3] = argValues[15] = argValues[27] = argValues[39] = &si16; |
|---|
| 276 | n/a | argTypes[4] = argTypes[16] = argTypes[28] = argTypes[40] = &ffi_type_uint32; |
|---|
| 277 | n/a | argValues[4] = argValues[16] = argValues[28] = argValues[40] = &ui32; |
|---|
| 278 | n/a | argTypes[5] = argTypes[17] = argTypes[29] = argTypes[41] = &ffi_type_sint32; |
|---|
| 279 | n/a | argValues[5] = argValues[17] = argValues[29] = argValues[41] = &si32; |
|---|
| 280 | n/a | argTypes[6] = argTypes[18] = argTypes[30] = argTypes[42] = &ffi_type_uint64; |
|---|
| 281 | n/a | argValues[6] = argValues[18] = argValues[30] = argValues[42] = &ui64; |
|---|
| 282 | n/a | argTypes[7] = argTypes[19] = argTypes[31] = argTypes[43] = &ffi_type_sint64; |
|---|
| 283 | n/a | argValues[7] = argValues[19] = argValues[31] = argValues[43] = &si64; |
|---|
| 284 | n/a | argTypes[8] = argTypes[20] = argTypes[32] = argTypes[44] = &ffi_type_float; |
|---|
| 285 | n/a | argValues[8] = argValues[20] = argValues[32] = argValues[44] = &f; |
|---|
| 286 | n/a | argTypes[9] = argTypes[21] = argTypes[33] = argTypes[45] = &ffi_type_double; |
|---|
| 287 | n/a | argValues[9] = argValues[21] = argValues[33] = argValues[45] = &d; |
|---|
| 288 | n/a | argTypes[10] = argTypes[22] = argTypes[34] = argTypes[46] = &ffi_type_longdouble; |
|---|
| 289 | n/a | argValues[10] = argValues[22] = argValues[34] = argValues[46] = &ld; |
|---|
| 290 | n/a | argTypes[11] = argTypes[23] = argTypes[35] = argTypes[47] = &ffi_type_pointer; |
|---|
| 291 | n/a | argValues[11] = argValues[23] = argValues[35] = argValues[47] = &p; |
|---|
| 292 | n/a | |
|---|
| 293 | n/a | argTypes[50] = NULL; |
|---|
| 294 | n/a | argValues[50] = NULL; |
|---|
| 295 | n/a | |
|---|
| 296 | n/a | CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); |
|---|
| 297 | n/a | |
|---|
| 298 | n/a | ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); |
|---|
| 299 | n/a | /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ |
|---|
| 300 | n/a | printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 301 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 302 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 303 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 "\n", |
|---|
| 304 | n/a | retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, |
|---|
| 305 | n/a | retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, |
|---|
| 306 | n/a | retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, |
|---|
| 307 | n/a | retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, |
|---|
| 308 | n/a | retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, |
|---|
| 309 | n/a | retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, |
|---|
| 310 | n/a | retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, |
|---|
| 311 | n/a | retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); |
|---|
| 312 | n/a | /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ |
|---|
| 313 | n/a | |
|---|
| 314 | n/a | CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); |
|---|
| 315 | n/a | |
|---|
| 316 | n/a | retVal = ((BigStruct(*)( |
|---|
| 317 | n/a | uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, |
|---|
| 318 | n/a | uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, |
|---|
| 319 | n/a | uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, |
|---|
| 320 | n/a | uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, |
|---|
| 321 | n/a | uint8_t, int8_t))(code))( |
|---|
| 322 | n/a | ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, |
|---|
| 323 | n/a | ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, |
|---|
| 324 | n/a | ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, |
|---|
| 325 | n/a | ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, |
|---|
| 326 | n/a | ui8, si8); |
|---|
| 327 | n/a | /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ |
|---|
| 328 | n/a | printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 329 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 330 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " |
|---|
| 331 | n/a | "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 "\n", |
|---|
| 332 | n/a | retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, |
|---|
| 333 | n/a | retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, |
|---|
| 334 | n/a | retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, |
|---|
| 335 | n/a | retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, |
|---|
| 336 | n/a | retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, |
|---|
| 337 | n/a | retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, |
|---|
| 338 | n/a | retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, |
|---|
| 339 | n/a | retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); |
|---|
| 340 | n/a | /* { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } */ |
|---|
| 341 | n/a | |
|---|
| 342 | n/a | return 0; |
|---|
| 343 | n/a | } |
|---|