return_ll.c 853 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* Area: ffi_call
  2. Purpose: Check return value long long.
  3. Limitations: none.
  4. PR: none.
  5. Originator: From the original ffitest.c */
  6. /* { dg-do run } */
  7. #include "ffitest.h"
  8. static long long return_ll(long long ll)
  9. {
  10. return ll;
  11. }
  12. int main (void)
  13. {
  14. ffi_cif cif;
  15. ffi_type *args[MAX_ARGS];
  16. void *values[MAX_ARGS];
  17. long long rlonglong;
  18. long long ll;
  19. args[0] = &ffi_type_sint64;
  20. values[0] = ≪
  21. /* Initialize the cif */
  22. CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
  23. &ffi_type_sint64, args) == FFI_OK);
  24. for (ll = 0LL; ll < 100LL; ll++)
  25. {
  26. ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
  27. CHECK(rlonglong == ll);
  28. }
  29. for (ll = 55555555555000LL; ll < 55555555555100LL; ll++)
  30. {
  31. ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
  32. CHECK(rlonglong == ll);
  33. }
  34. exit(0);
  35. }