2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / libffi / testsuite / libffi.go / aa-direct.c
blobb00c404ab353afaff3a75eb8582bc5e82c54b573
1 /* { dg-do run } */
3 #include "static-chain.h"
5 #if defined(__GNUC__) && !defined(__clang__) && defined(STATIC_CHAIN_REG)
7 #include "ffitest.h"
9 /* Blatent assumption here that the prologue doesn't clobber the
10 static chain for trivial functions. If this is not true, don't
11 define STATIC_CHAIN_REG, and we'll test what we can via other tests. */
12 void *doit(void)
14 register void *chain __asm__(STATIC_CHAIN_REG);
15 return chain;
18 int main()
20 ffi_cif cif;
21 void *result;
23 CHECK(ffi_prep_cif(&cif, ABI_NUM, 0, &ffi_type_pointer, NULL) == FFI_OK);
25 ffi_call_go(&cif, FFI_FN(doit), &result, NULL, &result);
27 CHECK(result == &result);
29 return 0;
32 #else /* UNSUPPORTED */
33 int main() { return 0; }
34 #endif