| 1 |
#include <stdlib.h> |
| 2 |
#include <stdint.h> |
| 3 |
/* interopse with myftype_1 */ |
| 4 |
typedef struct { |
| 5 |
float val1; |
| 6 |
double val2; |
| 7 |
long double val3; |
| 8 |
float _Complex val4; |
| 9 |
double _Complex val5; |
| 10 |
long double _Complex val6; |
| 11 |
_Bool val7; |
| 12 |
/* FIXME: Fortran define c_char as array of size 1. |
| 13 |
char val8; */ |
| 14 |
} myctype_t; |
| 15 |
|
| 16 |
|
| 17 |
extern void abort(void); |
| 18 |
void types_test1(void); |
| 19 |
void types_test2(void); |
| 20 |
void types_test3(void); |
| 21 |
void types_test4(void); |
| 22 |
void types_test5(void); |
| 23 |
void types_test6(void); |
| 24 |
void types_test7(void); |
| 25 |
void types_test8(void); |
| 26 |
/* declared in the fortran module */ |
| 27 |
extern myctype_t myVar; |
| 28 |
|
| 29 |
#define test(n)\ |
| 30 |
cchr->val##n = 1; types_test##n (); if (cchr->val##n != 2) abort (); |
| 31 |
|
| 32 |
int main(int argc, char **argv) |
| 33 |
{ |
| 34 |
myctype_t *cchr; |
| 35 |
asm("":"=r"(cchr):"0"(&myVar)); |
| 36 |
test(1); |
| 37 |
test(2); |
| 38 |
test(3); |
| 39 |
test(4); |
| 40 |
test(5); |
| 41 |
test(6); |
| 42 |
cchr->val7 = 0; types_test7 (); if (cchr->val7 != 1) abort (); |
| 43 |
/*cchr->val8 = 0; types_test8 (); if (cchr->val8 != 'a') abort ();*/ |
| 44 |
return 0; |
| 45 |
} |
| 46 |
|