| 1 |
/* Area: ffi_call, unwind info |
| 2 |
Purpose: Check if the unwind information is passed correctly. |
| 3 |
Limitations: none. |
| 4 |
PR: none. |
| 5 |
Originator: Andreas Tobler <[email protected]> 20061213 */ |
| 6 |
|
| 7 |
/* { dg-do run { xfail moxie*-*-* } } */ |
| 8 |
|
| 9 |
#include "ffitest.h" |
| 10 |
|
| 11 |
static int checking(int a __UNUSED__, short b __UNUSED__, |
| 12 |
signed char c __UNUSED__) |
| 13 |
{ |
| 14 |
throw 9; |
| 15 |
} |
| 16 |
|
| 17 |
#ifdef __EMSCRIPTEN__ |
| 18 |
extern "C" |
| 19 |
#endif |
| 20 |
int main (void) |
| 21 |
{ |
| 22 |
ffi_cif cif; |
| 23 |
ffi_type *args[MAX_ARGS]; |
| 24 |
void *values[MAX_ARGS]; |
| 25 |
ffi_arg rint; |
| 26 |
|
| 27 |
signed int si; |
| 28 |
signed short ss; |
| 29 |
signed char sc; |
| 30 |
|
| 31 |
args[0] = &ffi_type_sint; |
| 32 |
values[0] = &si; |
| 33 |
args[1] = &ffi_type_sshort; |
| 34 |
values[1] = &ss; |
| 35 |
args[2] = &ffi_type_schar; |
| 36 |
values[2] = ≻ |
| 37 |
|
| 38 |
/* Initialize the cif */ |
| 39 |
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, |
| 40 |
&ffi_type_sint, args) == FFI_OK); |
| 41 |
|
| 42 |
si = -6; |
| 43 |
ss = -12; |
| 44 |
sc = -1; |
| 45 |
{ |
| 46 |
try |
| 47 |
{ |
| 48 |
ffi_call(&cif, FFI_FN(checking), &rint, values); |
| 49 |
} catch (int exception_code) |
| 50 |
{ |
| 51 |
CHECK(exception_code == 9); |
| 52 |
} |
| 53 |
printf("part one OK\n"); |
| 54 |
/* { dg-output "part one OK" } */ |
| 55 |
} |
| 56 |
exit(0); |
| 57 |
} |