| 1 |
#include <stdlib.h> |
| 2 |
#include <stdint.h> |
| 3 |
/* interopse with myftype_1 */ |
| 4 |
typedef struct { |
| 5 |
int val1; |
| 6 |
short int val2; |
| 7 |
long int val3; |
| 8 |
long long int val4; |
| 9 |
size_t val5; |
| 10 |
int8_t val6; |
| 11 |
int16_t val7; |
| 12 |
int32_t val8; |
| 13 |
int64_t val9; |
| 14 |
int_least8_t val10; |
| 15 |
int_least16_t val11; |
| 16 |
int_least32_t val12; |
| 17 |
int_least64_t val13; |
| 18 |
int_fast8_t val14; |
| 19 |
int_fast16_t val15; |
| 20 |
int_fast32_t val16; |
| 21 |
int_fast64_t val17; |
| 22 |
intmax_t val18; |
| 23 |
intptr_t val19; |
| 24 |
} myctype_t; |
| 25 |
|
| 26 |
|
| 27 |
extern void abort(void); |
| 28 |
void types_test1(void); |
| 29 |
void types_test2(void); |
| 30 |
void types_test3(void); |
| 31 |
void types_test4(void); |
| 32 |
void types_test5(void); |
| 33 |
void types_test6(void); |
| 34 |
void types_test7(void); |
| 35 |
void types_test8(void); |
| 36 |
void types_test9(void); |
| 37 |
void types_test10(void); |
| 38 |
void types_test11(void); |
| 39 |
void types_test12(void); |
| 40 |
void types_test13(void); |
| 41 |
void types_test14(void); |
| 42 |
void types_test15(void); |
| 43 |
void types_test16(void); |
| 44 |
void types_test17(void); |
| 45 |
void types_test18(void); |
| 46 |
void types_test19(void); |
| 47 |
/* declared in the fortran module */ |
| 48 |
extern myctype_t myVar; |
| 49 |
|
| 50 |
#define test(n)\ |
| 51 |
cchr->val##n = 1; types_test##n (); if (cchr->val##n != 2) abort (); |
| 52 |
|
| 53 |
int main(int argc, char **argv) |
| 54 |
{ |
| 55 |
myctype_t *cchr; |
| 56 |
asm("":"=r"(cchr):"0"(&myVar)); |
| 57 |
test(1); |
| 58 |
test(2); |
| 59 |
test(3); |
| 60 |
test(4); |
| 61 |
test(5); |
| 62 |
test(6); |
| 63 |
test(7); |
| 64 |
test(8); |
| 65 |
test(9); |
| 66 |
test(10); |
| 67 |
test(11); |
| 68 |
test(12); |
| 69 |
test(13); |
| 70 |
test(14); |
| 71 |
test(15); |
| 72 |
test(16); |
| 73 |
test(17); |
| 74 |
test(18); |
| 75 |
test(19); |
| 76 |
return 0; |
| 77 |
} |
| 78 |
|