From f301b34db1b615f46b2475e89c59ce3bd3f62316 Mon Sep 17 00:00:00 2001 From: a Date: Wed, 7 Sep 2022 20:24:44 -0700 Subject: [PATCH] Add test cases for interoperability with C about fortran call C --- 3-add-tests-interoperability-C.patch | 13334 +++++++++++++++++++++++++ flang.spec | 6 +- 2 files changed, 13339 insertions(+), 1 deletion(-) create mode 100644 3-add-tests-interoperability-C.patch diff --git a/3-add-tests-interoperability-C.patch b/3-add-tests-interoperability-C.patch new file mode 100644 index 0000000..53f08f3 --- /dev/null +++ b/3-add-tests-interoperability-C.patch @@ -0,0 +1,13334 @@ +From 167be0ef01ab4e4be233f8971da144f865b3699e Mon Sep 17 00:00:00 2001 +From: a +Date: Wed, 31 Aug 2022 19:31:22 -0700 +Subject: [flang] add test cases for interoperability with C about fortran call C + +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func001.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func001.c +new file mode 100644 +index 0000000..5acb3c0 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func001.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(int *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func002.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func002.c +new file mode 100644 +index 0000000..a695d21 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(short *a) { ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func003.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func003.c +new file mode 100644 +index 0000000..c3e2b1b +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func004.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func004.c +new file mode 100644 +index 0000000..c83f515 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long long *a) { ++ printf("%lld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func005.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func005.c +new file mode 100644 +index 0000000..df53145 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func005.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(signed char *a) { ++ printf("%c\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func006.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func006.c +new file mode 100644 +index 0000000..bf8fe98 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func006.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(size_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func007.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func007.c +new file mode 100644 +index 0000000..1ccc2d3 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func007.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int8_t *a) { ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func008.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func008.c +new file mode 100644 +index 0000000..5b4a477 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func008.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int16_t *a) { ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func009.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func009.c +new file mode 100644 +index 0000000..ef5dbab +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func009.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int32_t *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func010.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func010.c +new file mode 100644 +index 0000000..ff0c5b2 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func010.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int64_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func011.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func011.c +new file mode 100644 +index 0000000..648e234 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func011.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least8_t *a) { ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func012.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func012.c +new file mode 100644 +index 0000000..175d427 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func012.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least16_t *a) { ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func013.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func013.c +new file mode 100644 +index 0000000..3e63c13 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func013.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least32_t *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func014.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func014.c +new file mode 100644 +index 0000000..ac6a62b +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func014.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least64_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func015.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func015.c +new file mode 100644 +index 0000000..85b98cc +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func015.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast8_t *a) { ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func016.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func016.c +new file mode 100644 +index 0000000..ce358c3 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func016.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast16_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func017.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func017.c +new file mode 100644 +index 0000000..9576185 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func017.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast32_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func018.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func018.c +new file mode 100644 +index 0000000..84469ba +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func018.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast64_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func019.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func019.c +new file mode 100644 +index 0000000..acd8949 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func019.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(intmax_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func020.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func020.c +new file mode 100644 +index 0000000..43c01a7 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func020.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(intptr_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func021.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func021.c +new file mode 100644 +index 0000000..af99025 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func021.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(float *a) { ++ printf("%f\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func022.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func022.c +new file mode 100644 +index 0000000..7ae046f +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func022.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(double *a) { ++ printf("%0.20f\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func023.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func023.c +new file mode 100644 +index 0000000..be8b2b1 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func023.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(long double *a) { ++ printf("%0.20Lf\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func024.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func024.c +new file mode 100644 +index 0000000..1e65f36 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func024.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(float _Complex *t) { ++ printf("%f + %fi\n", creal(*t), cimag(*t)); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func025.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func025.c +new file mode 100644 +index 0000000..b3f9944 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func025.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(*t), cimag(*t)); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func026.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func026.c +new file mode 100644 +index 0000000..c049c6f +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func026.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func027.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func027.c +new file mode 100644 +index 0000000..a3a8596 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func027.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(_Bool *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/c_func028.c b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func028.c +new file mode 100644 +index 0000000..0abbf89 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/c_func028.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(char *a) { ++ printf("%c\n", *a); ++} +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main001.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main001.f90 +new file mode 100644 +index 0000000..67065b5 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main001.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is int ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(4) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main002.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main002.f90 +new file mode 100644 +index 0000000..be8e4a6 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main002.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is short ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(2) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main003.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main003.f90 +new file mode 100644 +index 0000000..32fe301 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main003.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is long ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main004.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main004.f90 +new file mode 100644 +index 0000000..fec8bc8 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main004.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long long ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main005.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main005.f90 +new file mode 100644 +index 0000000..1c70d24 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main005.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! signed char ++! ++program main ++ integer(1) :: my_x = 65 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main006.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main006.f90 +new file mode 100644 +index 0000000..1c51bf7 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main006.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is size_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main007.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main007.f90 +new file mode 100644 +index 0000000..1905558 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main007.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is int8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main008.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main008.f90 +new file mode 100644 +index 0000000..ad502f7 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main008.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int16_t ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(2) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main009.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main009.f90 +new file mode 100644 +index 0000000..ff8e413 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main009.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(4) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main010.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main010.f90 +new file mode 100644 +index 0000000..b2bb503 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main010.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main011.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main011.f90 +new file mode 100644 +index 0000000..b63979f +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main011.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main012.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main012.f90 +new file mode 100644 +index 0000000..4b57843 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main012.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least16_t ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(2) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main013.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main013.f90 +new file mode 100644 +index 0000000..38f4dbf +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main013.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(4) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main014.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main014.f90 +new file mode 100644 +index 0000000..76db856 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main014.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main015.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main015.f90 +new file mode 100644 +index 0000000..22edd3a +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main015.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main016.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main016.f90 +new file mode 100644 +index 0000000..16194de +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main016.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast_16_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main017.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main017.f90 +new file mode 100644 +index 0000000..d26c6f2 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main017.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast32_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main018.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main018.f90 +new file mode 100644 +index 0000000..1fa0b83 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main018.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main019.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main019.f90 +new file mode 100644 +index 0000000..5e4dd89 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main019.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intmax_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main020.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main020.f90 +new file mode 100644 +index 0000000..12e4c74 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main020.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intptr_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main021.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main021.f90 +new file mode 100644 +index 0000000..d702c52 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main021.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is float ++! ++program main ++ real(4) :: my_x = 3.1415926535 ++ interface ++ subroutine c_func(b) ++ real(4) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main022.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main022.f90 +new file mode 100644 +index 0000000..fb9895b +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main022.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is double ++! ++program main ++ real(8) :: my_x = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ real(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main023.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main023.f90 +new file mode 100644 +index 0000000..bc2c2b7 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long double ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main024.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main024.f90 +new file mode 100644 +index 0000000..3b9f2d4 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main024.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! float _Complex ++! ++program main ++ complex(4) :: my_x = (-12345678.7654321, 1) ++ interface ++ subroutine c_func(b) ++ complex(4) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main025.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main025.f90 +new file mode 100644 +index 0000000..f4f3f9f +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main025.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! double _Complex ++! ++program main ++ complex(8) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ complex(8) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main026.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main026.f90 +new file mode 100644 +index 0000000..b02bca6 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main026.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long double _Complex ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main027.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main027.f90 +new file mode 100644 +index 0000000..e9aaf8e +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main027.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is _Bool ++! ++program main ++ logical(1) :: my_x = .FALSE. ++ interface ++ subroutine c_func(b) ++ logical(1) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main028.f90 b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main028.f90 +new file mode 100644 +index 0000000..6fab824 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/fortran_main028.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the scalar type and the scalar type is char ++! ++program main ++ character(1) :: my_x = 'a' ++ interface ++ subroutine c_func(b) ++ character(1) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/001_fortran_call_c_scalar/run.sh b/test/interoperability_with_c/001_fortran_call_c_scalar/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/001_fortran_call_c_scalar/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func001.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func001.c +new file mode 100644 +index 0000000..5acb3c0 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func001.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(int *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func002.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func002.c +new file mode 100644 +index 0000000..a695d21 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(short *a) { ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func003.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func003.c +new file mode 100644 +index 0000000..c3e2b1b +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func004.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func004.c +new file mode 100644 +index 0000000..c83f515 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long long *a) { ++ printf("%lld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func005.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func005.c +new file mode 100644 +index 0000000..df53145 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func005.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(signed char *a) { ++ printf("%c\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func006.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func006.c +new file mode 100644 +index 0000000..bf8fe98 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func006.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(size_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func007.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func007.c +new file mode 100644 +index 0000000..1ccc2d3 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func007.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int8_t *a) { ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func008.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func008.c +new file mode 100644 +index 0000000..5b4a477 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func008.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int16_t *a) { ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func009.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func009.c +new file mode 100644 +index 0000000..ef5dbab +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func009.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int32_t *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func010.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func010.c +new file mode 100644 +index 0000000..ff0c5b2 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func010.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int64_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func011.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func011.c +new file mode 100644 +index 0000000..648e234 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func011.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least8_t *a) { ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func012.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func012.c +new file mode 100644 +index 0000000..175d427 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func012.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least16_t *a) { ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func013.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func013.c +new file mode 100644 +index 0000000..3e63c13 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func013.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least32_t *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func014.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func014.c +new file mode 100644 +index 0000000..ac6a62b +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func014.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least64_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func015.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func015.c +new file mode 100644 +index 0000000..85b98cc +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func015.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast8_t *a) { ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func016.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func016.c +new file mode 100644 +index 0000000..ce358c3 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func016.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast16_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func017.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func017.c +new file mode 100644 +index 0000000..9576185 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func017.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast32_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func018.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func018.c +new file mode 100644 +index 0000000..84469ba +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func018.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast64_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func019.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func019.c +new file mode 100644 +index 0000000..acd8949 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func019.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(intmax_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func020.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func020.c +new file mode 100644 +index 0000000..43c01a7 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func020.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(intptr_t *a) { ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func021.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func021.c +new file mode 100644 +index 0000000..af99025 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func021.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(float *a) { ++ printf("%f\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func022.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func022.c +new file mode 100644 +index 0000000..4b65d00 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func022.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(double *a) { ++ printf("%0.20lf\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func023.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func023.c +new file mode 100644 +index 0000000..be8b2b1 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func023.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(long double *a) { ++ printf("%0.20Lf\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func024.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func024.c +new file mode 100644 +index 0000000..1e65f36 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func024.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(float _Complex *t) { ++ printf("%f + %fi\n", creal(*t), cimag(*t)); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func025.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func025.c +new file mode 100644 +index 0000000..b3f9944 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func025.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(*t), cimag(*t)); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func026.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func026.c +new file mode 100644 +index 0000000..c049c6f +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func026.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func027.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func027.c +new file mode 100644 +index 0000000..a3a8596 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func027.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(_Bool *a) { ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func028.c b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func028.c +new file mode 100644 +index 0000000..0abbf89 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/c_func028.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(char *a) { ++ printf("%c\n", *a); ++} +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main001.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main001.f90 +new file mode 100644 +index 0000000..6f79a57 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main001.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is int ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main002.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main002.f90 +new file mode 100644 +index 0000000..61250b0 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main002.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is short ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_SHORT) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_SHORT) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main003.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main003.f90 +new file mode 100644 +index 0000000..8620d6d +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main003.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is long ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_LONG) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_LONG) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main004.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main004.f90 +new file mode 100644 +index 0000000..bc27cec +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main004.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long long with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_LONG_LONG) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_LONG_LONG) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main005.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main005.f90 +new file mode 100644 +index 0000000..8b74204 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main005.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! signed char with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_SIGNED_CHAR) :: my_x = 65 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_SIGNED_CHAR) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main006.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main006.f90 +new file mode 100644 +index 0000000..29062ec +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main006.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is size_t ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_SIZE_T) :: my_x = 3 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_SIZE_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main007.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main007.f90 +new file mode 100644 +index 0000000..55d0f75 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main007.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is int8_t ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT8_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT8_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main008.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main008.f90 +new file mode 100644 +index 0000000..436e139 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main008.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int16_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT16_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT16_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main009.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main009.f90 +new file mode 100644 +index 0000000..0a02bc2 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main009.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int32_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT32_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT32_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main010.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main010.f90 +new file mode 100644 +index 0000000..2d29eef +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main010.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int64_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT64_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT64_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main011.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main011.f90 +new file mode 100644 +index 0000000..36b1865 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main011.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least_8_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST8_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST8_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main012.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main012.f90 +new file mode 100644 +index 0000000..4c199ae +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main012.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least16_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST16_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST16_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main013.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main013.f90 +new file mode 100644 +index 0000000..935f899 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main013.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least32_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST32_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST32_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main014.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main014.f90 +new file mode 100644 +index 0000000..71767d8 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main014.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least64_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST64_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST64_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main015.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main015.f90 +new file mode 100644 +index 0000000..a4fa2c8 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main015.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast8_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST8_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST8_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main016.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main016.f90 +new file mode 100644 +index 0000000..a249371 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main016.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast16_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST16_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST16_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main017.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main017.f90 +new file mode 100644 +index 0000000..5054223 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main017.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast32_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST32_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST32_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main018.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main018.f90 +new file mode 100644 +index 0000000..a4c7df9 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main018.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast64_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST64_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST64_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main019.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main019.f90 +new file mode 100644 +index 0000000..d01dc8b +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main019.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intmax_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INTMAX_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INTMAX_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main020.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main020.f90 +new file mode 100644 +index 0000000..8724899 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main020.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intptr_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INTPTR_T) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INTPTR_T) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main021.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main021.f90 +new file mode 100644 +index 0000000..3aa93f5 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main021.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is float ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ real(C_FLOAT) :: my_x = 12345678.7654321 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ real(C_FLOAT) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main022.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main022.f90 +new file mode 100644 +index 0000000..d38e122 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main022.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is double ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ real(C_DOUBLE) :: my_x = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ real(C_DOUBLE) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main023.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main023.f90 +new file mode 100644 +index 0000000..ab97171 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long double with iso_c_binding ++! ++program main ++ use iso_c_binding ++ real(C_LONG_DOUBLE) :: my_x = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ real(C_LONG_DOUBLE) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main024.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main024.f90 +new file mode 100644 +index 0000000..fa413ee +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main024.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! float _Complex with iso_c_binding ++! ++program main ++ use iso_c_binding ++ complex(C_FLOAT_COMPLEX) :: my_x = (-12345678.7654321, 1) ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ complex(C_FLOAT_COMPLEX) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main025.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main025.f90 +new file mode 100644 +index 0000000..1f07917 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main025.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! double _Complex with iso_c_binding ++! ++program main ++ use iso_c_binding ++ complex(C_DOUBLE_COMPLEX) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ complex(C_DOUBLE_COMPLEX) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main026.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main026.f90 +new file mode 100644 +index 0000000..7a1d999 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main026.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long double _Complex with iso_c_binding ++! ++program main ++ use iso_c_binding ++ complex(C_LONG_DOUBLE_COMPLEX) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ complex(C_LONG_DOUBLE_COMPLEX) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main027.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main027.f90 +new file mode 100644 +index 0000000..5c5b626 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main027.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is _Bool ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ logical(C_BOOL) :: my_x = .FALSE. ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ logical(C_BOOL) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main028.f90 b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main028.f90 +new file mode 100644 +index 0000000..cea2d0b +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/fortran_main028.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is char ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ character(C_CHAR) :: my_x = 'a' ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ character(C_CHAR) :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/run.sh b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/002_fortran_call_c_scalar_bindc/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func001.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func001.c +new file mode 100644 +index 0000000..6b34fe7 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func001.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(int a) { ++ printf("%d\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func002.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func002.c +new file mode 100644 +index 0000000..0a82fd6 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(short a) { ++ printf("%hd\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func003.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func003.c +new file mode 100644 +index 0000000..e945b70 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func004.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func004.c +new file mode 100644 +index 0000000..6d5f734 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long long a) { ++ printf("%lld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func005.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func005.c +new file mode 100644 +index 0000000..aa46418 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func005.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(signed char a) { ++ printf("%c\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func006.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func006.c +new file mode 100644 +index 0000000..d78d3d5 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func006.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(size_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func007.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func007.c +new file mode 100644 +index 0000000..2e08462 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func007.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int8_t a) { ++ printf("%hhd\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func008.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func008.c +new file mode 100644 +index 0000000..9b10264 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func008.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int16_t a) { ++ printf("%hd\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func009.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func009.c +new file mode 100644 +index 0000000..7ed8d51 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func009.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int32_t a) { ++ printf("%d\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func010.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func010.c +new file mode 100644 +index 0000000..426f6ae +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func010.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int64_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func011.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func011.c +new file mode 100644 +index 0000000..660f33e +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func011.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least8_t a) { ++ printf("%hhd\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func012.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func012.c +new file mode 100644 +index 0000000..abf7d13 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func012.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least16_t a) { ++ printf("%hd\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func013.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func013.c +new file mode 100644 +index 0000000..638f7d0 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func013.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least32_t a) { ++ printf("%d\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func014.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func014.c +new file mode 100644 +index 0000000..c0401de +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func014.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_least64_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func015.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func015.c +new file mode 100644 +index 0000000..f7b7caa +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func015.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast8_t a) { ++ printf("%hhd\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func016.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func016.c +new file mode 100644 +index 0000000..ef70772 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func016.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast16_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func017.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func017.c +new file mode 100644 +index 0000000..86e6cd6 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func017.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast32_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func018.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func018.c +new file mode 100644 +index 0000000..c8ae092 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func018.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(int_fast64_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func019.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func019.c +new file mode 100644 +index 0000000..0b0fa15 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func019.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(intmax_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func020.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func020.c +new file mode 100644 +index 0000000..bde599d +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func020.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(intptr_t a) { ++ printf("%ld\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func021.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func021.c +new file mode 100644 +index 0000000..ae5bf11 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func021.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(float a) { ++ printf("%f\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func022.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func022.c +new file mode 100644 +index 0000000..b3bdc55 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func022.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(double a) { ++ printf("%0.20lf\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func023.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func023.c +new file mode 100644 +index 0000000..af99efc +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func023.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(long double a) { ++ printf("%0.20Lf\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func024.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func024.c +new file mode 100644 +index 0000000..af69eac +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func024.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(float _Complex t) { ++ printf("%0.20f + %0.20fi\n", creal(t), cimag(t)); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func025.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func025.c +new file mode 100644 +index 0000000..55a85e9 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func025.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(double _Complex t) { ++ printf("%0.20lf + %0.20lfi\n", creal(t), cimag(t)); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func026.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func026.c +new file mode 100644 +index 0000000..5b7017a +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func026.c +@@ -0,0 +1,5 @@ ++#include ++#include ++void c_func_(long double _Complex t) { ++ printf("%0.20f + %0.20fi\n", creal(t), cimag(t)); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func027.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func027.c +new file mode 100644 +index 0000000..ff95fd7 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func027.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(_Bool a) { ++ printf("%d\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func028.c b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func028.c +new file mode 100644 +index 0000000..b92caf7 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/c_func028.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(char a) { ++ printf("%c\n", a); ++} +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main001.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main001.f90 +new file mode 100644 +index 0000000..68a4e65 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main001.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int without iso_c_binding ++! ++program main ++ integer :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer, value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main002.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main002.f90 +new file mode 100644 +index 0000000..f98661e +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main002.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is short without iso_c_binding ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(2), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main003.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main003.f90 +new file mode 100644 +index 0000000..56d73bb +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main003.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is long without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main004.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main004.f90 +new file mode 100644 +index 0000000..bd26e3d +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main004.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is long long without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main005.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main005.f90 +new file mode 100644 +index 0000000..c603a40 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main005.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is signed char without iso_c_binding ++! ++program main ++ integer(1) :: my_x = 65 ++ interface ++ subroutine c_func(b) ++ integer(1), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main006.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main006.f90 +new file mode 100644 +index 0000000..08e4cab +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main006.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is size_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 3 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main007.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main007.f90 +new file mode 100644 +index 0000000..6fbc4f1 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main007.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int8_t without iso_c_binding ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(1), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main008.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main008.f90 +new file mode 100644 +index 0000000..dadfeb3 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main008.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int16_t without iso_c_binding ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(2), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main009.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main009.f90 +new file mode 100644 +index 0000000..b9589e6 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main009.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(4), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main010.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main010.f90 +new file mode 100644 +index 0000000..a756881 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main010.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int64_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main011.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main011.f90 +new file mode 100644 +index 0000000..58a7483 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main011.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_least8_t without iso_c_binding ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(1), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main012.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main012.f90 +new file mode 100644 +index 0000000..a5c8e34 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main012.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_least16_t without iso_c_binding ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(2), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main013.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main013.f90 +new file mode 100644 +index 0000000..8705110 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main013.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_least32_t without iso_c_binding ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(4), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main014.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main014.f90 +new file mode 100644 +index 0000000..327434e +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main014.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_least64_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main015.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main015.f90 +new file mode 100644 +index 0000000..b911744 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main015.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_fast8_t without iso_c_binding ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(1), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main016.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main016.f90 +new file mode 100644 +index 0000000..43c1d3f +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main016.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_fast16_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main017.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main017.f90 +new file mode 100644 +index 0000000..dd03c20 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main017.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_fast32_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main018.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main018.f90 +new file mode 100644 +index 0000000..aed4502 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main018.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is int_fast64_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main019.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main019.f90 +new file mode 100644 +index 0000000..47f84e9 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main019.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is intmax_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 3 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main020.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main020.f90 +new file mode 100644 +index 0000000..2d3d9fa +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main020.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is intptr_t without iso_c_binding ++! ++program main ++ integer(8) :: my_x = 3 ++ interface ++ subroutine c_func(b) ++ integer(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main021.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main021.f90 +new file mode 100644 +index 0000000..4bb2e37 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main021.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is float without iso_c_binding ++! ++program main ++ real(4) :: my_x = 12345678.7654321 ++ interface ++ subroutine c_func(b) ++ real(4), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main022.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main022.f90 +new file mode 100644 +index 0000000..33d79e5 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main022.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is double without iso_c_binding ++! ++program main ++ real(8) :: my_x = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ real(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main023.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main023.f90 +new file mode 100644 +index 0000000..9d090e9 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is long double without iso_c_binding ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ real(K), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main024.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main024.f90 +new file mode 100644 +index 0000000..7a6d9e4 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main024.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is float _Complex without iso_c_binding ++! ++program main ++ complex(4) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ complex(4), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main025.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main025.f90 +new file mode 100644 +index 0000000..cf1ae5c +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main025.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is double _Complex without iso_c_binding ++! ++program main ++ complex(8) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ complex(8), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main026.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main026.f90 +new file mode 100644 +index 0000000..e46d83c +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main026.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is long double _Complex without iso_c_binding ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main027.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main027.f90 +new file mode 100644 +index 0000000..fc3103e +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main027.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is _Bool without iso_c_binding ++! ++program main ++ logical(1) :: my_x = .FALSE. ++ interface ++ subroutine c_func(b) ++ logical(1), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main028.f90 b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main028.f90 +new file mode 100644 +index 0000000..39a3c40 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/fortran_main028.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type with value attribute and the ++! scalar type is _char without iso_c_binding ++! ++program main ++ character(1) :: my_x = 'a' ++ interface ++ subroutine c_func(b) ++ character(1), value :: b ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/003_fortran_call_c_scalar_value/run.sh b/test/interoperability_with_c/003_fortran_call_c_scalar_value/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/003_fortran_call_c_scalar_value/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func001.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func001.c +new file mode 100755 +index 0000000..042849e +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func001.c +@@ -0,0 +1,8 @@ ++#include ++struct Ty { ++ int x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x); ++ printf("%d\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func002.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func002.c +new file mode 100755 +index 0000000..ad72ffd +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func002.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ short x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\t", t->x); ++ printf("%hd\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func003.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func003.c +new file mode 100755 +index 0000000..78540c0 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func003.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func004.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func004.c +new file mode 100755 +index 0000000..83bc034 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func004.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long long x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lld\t", t->x); ++ printf("%lld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func005.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func005.c +new file mode 100755 +index 0000000..f0ec8b1 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func005.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ signed char x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%c\t", t->x); ++ printf("%c\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func006.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func006.c +new file mode 100755 +index 0000000..a37766e +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func006.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ size_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func007.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func007.c +new file mode 100755 +index 0000000..71c4460 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func007.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int8_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\t", t->x); ++ printf("%hhd\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func008.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func008.c +new file mode 100755 +index 0000000..cc4c156 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func008.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int16_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\t", t->x); ++ printf("%hd\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func009.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func009.c +new file mode 100755 +index 0000000..81c3db1 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func009.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int32_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x); ++ printf("%d\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func010.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func010.c +new file mode 100755 +index 0000000..0d8b990 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func010.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int64_t x,y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func011.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func011.c +new file mode 100755 +index 0000000..9d65b2a +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func011.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least8_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\t", t->x); ++ printf("%hhd\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func012.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func012.c +new file mode 100755 +index 0000000..e77ab58 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func012.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least16_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\t", t->x); ++ printf("%hd\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func013.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func013.c +new file mode 100755 +index 0000000..c37c94e +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func013.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least32_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x); ++ printf("%d\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func014.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func014.c +new file mode 100755 +index 0000000..6f8a5b4 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func014.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least64_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func015.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func015.c +new file mode 100755 +index 0000000..9308c5b +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func015.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast8_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\t", t->x); ++ printf("%hhd\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func016.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func016.c +new file mode 100755 +index 0000000..1bdc74a +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func016.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast16_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func017.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func017.c +new file mode 100755 +index 0000000..017daeb +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func017.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast32_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func018.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func018.c +new file mode 100755 +index 0000000..3ab58e9 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func018.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast64_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func019.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func019.c +new file mode 100755 +index 0000000..9c68e8d +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func019.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ intmax_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func020.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func020.c +new file mode 100755 +index 0000000..9c41124 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func020.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ intptr_t x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x); ++ printf("%ld\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func021.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func021.c +new file mode 100755 +index 0000000..33704de +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func021.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ float x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f\t", t->x); ++ printf("%f\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func022.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func022.c +new file mode 100755 +index 0000000..e8beea1 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func022.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ double x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%0.20lf\t", t->x); ++ printf("%0.20lf\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func023.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func023.c +new file mode 100755 +index 0000000..a735b8d +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func023.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long double x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%0.20Lf\t", t->x); ++ printf("%0.20Lf\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func024.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func024.c +new file mode 100755 +index 0000000..aff5eaf +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func024.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ float _Complex x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->x), cimag(t->x)); ++ printf("%f + %fi\n", creal(t->y), cimag(t->y)); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func025.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func025.c +new file mode 100755 +index 0000000..cac2da2 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func025.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ double _Complex x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lf + %lfi\n", creal(t->x), cimag(t->x)); ++ printf("%lf + %lfi\n", creal(t->y), cimag(t->y)); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func026.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func026.c +new file mode 100755 +index 0000000..886667b +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func026.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long double _Complex x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->x), cimag(t->x)); ++ printf("%f + %fi\n", creal(t->y), cimag(t->y)); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func027.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func027.c +new file mode 100755 +index 0000000..ef8ac27 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func027.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ _Bool x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x); ++ printf("%d\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func028.c b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func028.c +new file mode 100755 +index 0000000..1b00b60 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/c_func028.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ char x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%c\t", t->x); ++ printf("%c\n", t->y); ++} +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main001.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main001.f90 +new file mode 100755 +index 0000000..f231f83 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main001.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer :: x = -2147483647 ++ integer :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main002.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main002.f90 +new file mode 100755 +index 0000000..35ed794 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main002.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type short without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(2) :: x = -32768 ++ integer(2) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main003.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main003.f90 +new file mode 100755 +index 0000000..7ead233 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main003.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type long without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -2147483647 ++ integer(8) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main004.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main004.f90 +new file mode 100755 +index 0000000..36b0ad2 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main004.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type long long without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main005.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main005.f90 +new file mode 100755 +index 0000000..2bf3dc8 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main005.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type signed char without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x = 65 ++ integer(1) :: y = 66 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main006.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main006.f90 +new file mode 100755 +index 0000000..38fae19 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main006.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type size_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = 0 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main007.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main007.f90 +new file mode 100755 +index 0000000..67aed08 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main007.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int8_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x = -128 ++ integer(1) :: y = 127 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main008.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main008.f90 +new file mode 100755 +index 0000000..023d8ed +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main008.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int16_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(2) :: x = -32768 ++ integer(2) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main009.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main009.f90 +new file mode 100755 +index 0000000..031594a +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main009.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int32_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(4) :: x = -2147483647 ++ integer(4) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main010.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main010.f90 +new file mode 100755 +index 0000000..71d48ae +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main010.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int64_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main011.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main011.f90 +new file mode 100755 +index 0000000..de94b0f +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main011.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_least_8_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x = -128 ++ integer(1) :: y = 127 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main012.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main012.f90 +new file mode 100755 +index 0000000..b824e33 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main012.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_least16_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(2) :: x = -32768 ++ integer(2) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main013.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main013.f90 +new file mode 100755 +index 0000000..87b0d0e +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main013.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_least32_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(4) :: x = -2147483647 ++ integer(4) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main014.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main014.f90 +new file mode 100755 +index 0000000..311421d +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main014.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_least_64_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main015.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main015.f90 +new file mode 100755 +index 0000000..cf6ce40 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main015.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_fast8_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x = -128 ++ integer(1) :: y = 127 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main016.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main016.f90 +new file mode 100755 +index 0000000..42ee76b +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main016.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_fast16_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -32768 ++ integer(8) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main017.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main017.f90 +new file mode 100755 +index 0000000..875933c +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main017.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_fast32_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -2147483647 ++ integer(8) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main018.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main018.f90 +new file mode 100755 +index 0000000..82a9960 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main018.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type int_fast64_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main019.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main019.f90 +new file mode 100755 +index 0000000..ec188ae +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main019.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type intmax_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main020.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main020.f90 +new file mode 100755 +index 0000000..a8fa89b +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main020.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type intptr_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main021.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main021.f90 +new file mode 100755 +index 0000000..19df542 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main021.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type float without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ real(4) :: x = 3.14 ++ real(4) :: y = 12345678.7654321 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main022.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main022.f90 +new file mode 100755 +index 0000000..52269a7 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main022.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type double without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ real(8) :: x = 3.14159265358979626 ++ real(8) :: y = 12345678.7654321 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main023.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main023.f90 +new file mode 100755 +index 0000000..63cc169 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main023.f90 +@@ -0,0 +1,18 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type long double without iso_c_binding ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: t ++ real(K) :: x = 3.14159265358979626 ++ real(K) :: y = 12345678.7654321 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main024.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main024.f90 +new file mode 100755 +index 0000000..499c66a +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main024.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type float _Complex without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ complex(4) :: x = (-3, 1) ++ complex(4) :: y = (3, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main025.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main025.f90 +new file mode 100755 +index 0000000..e90cd94 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main025.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type double _Complex without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ complex(8) :: x = (-3, 1) ++ complex(8) :: y = (3, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main026.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main026.f90 +new file mode 100755 +index 0000000..aead29b +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main026.f90 +@@ -0,0 +1,19 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type long double _Complex without ++! iso_c_binding ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: t ++ complex(K) :: x = (-3.1415926, 1.654) ++ complex(K) :: y = (3, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main027.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main027.f90 +new file mode 100755 +index 0000000..de0a887 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main027.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type bool without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ logical(1) :: x = .TRUE. ++ logical(1) :: y = .FALSE. ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main028.f90 b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main028.f90 +new file mode 100755 +index 0000000..b4319ed +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/fortran_main028.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is scalar of type char without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ character(1) :: x = 'b' ++ character(1) :: y = 'c' ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/004_fortran_call_c_scalar_struct/run.sh b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/004_fortran_call_c_scalar_struct/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func001.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func001.c +new file mode 100644 +index 0000000..c7cf73f +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func001.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(int *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func002.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func002.c +new file mode 100644 +index 0000000..010cdf7 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func002.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(short *a) { ++ printf("%hd\n", a[0]); ++ printf("%hd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func003.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func003.c +new file mode 100644 +index 0000000..5e69081 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func003.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(long *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func004.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func004.c +new file mode 100644 +index 0000000..3f74c8e +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func004.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(long long *a) { ++ printf("%lld\n", a[0]); ++ printf("%lld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func005.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func005.c +new file mode 100644 +index 0000000..77794d4 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func005.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(signed char *a) { ++ printf("%c\n", a[0]); ++ printf("%c\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func006.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func006.c +new file mode 100644 +index 0000000..27c475f +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func006.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(size_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func007.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func007.c +new file mode 100644 +index 0000000..f7c4384 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func007.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int8_t *a) { ++ printf("%hhd\n", a[0]); ++ printf("%hhd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func008.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func008.c +new file mode 100644 +index 0000000..e29971f +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func008.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int16_t *a) { ++ printf("%hd\n", a[0]); ++ printf("%hd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func009.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func009.c +new file mode 100644 +index 0000000..3b84c1a +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func009.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int32_t *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func010.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func010.c +new file mode 100644 +index 0000000..11ca3e1 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func010.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int64_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func011.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func011.c +new file mode 100644 +index 0000000..f830d74 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func011.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least8_t *a) { ++ printf("%hhd\n", a[0]); ++ printf("%hhd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func012.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func012.c +new file mode 100644 +index 0000000..6ffd7e3 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func012.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least16_t *a) { ++ printf("%hd\n", a[0]); ++ printf("%hd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func013.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func013.c +new file mode 100644 +index 0000000..4b367cb +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func013.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least32_t *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func014.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func014.c +new file mode 100644 +index 0000000..6b2d5b3 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func014.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least64_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func015.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func015.c +new file mode 100644 +index 0000000..81d223a +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func015.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast8_t *a) { ++ printf("%hhd\n", a[0]); ++ printf("%hhd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func016.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func016.c +new file mode 100644 +index 0000000..297be3a +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func016.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast16_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func017.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func017.c +new file mode 100644 +index 0000000..8eb5818 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func017.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast32_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func018.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func018.c +new file mode 100644 +index 0000000..030b1f7 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func018.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast64_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func019.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func019.c +new file mode 100644 +index 0000000..babfc75 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func019.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(intmax_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func020.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func020.c +new file mode 100644 +index 0000000..26c7726 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func020.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(intptr_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func021.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func021.c +new file mode 100644 +index 0000000..a73f11b +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func021.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(float *a) { ++ printf("%f\n", a[0]); ++ printf("%f\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func022.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func022.c +new file mode 100644 +index 0000000..688f3c0 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func022.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(double *a) { ++ printf("%20lf\n", a[0]); ++ printf("%20lf\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func023.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func023.c +new file mode 100644 +index 0000000..af86ba3 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func023.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(long double *a) { ++ printf("%20Lf\n", a[0]); ++ printf("%20Lf\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func024.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func024.c +new file mode 100644 +index 0000000..1d34f02 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func024.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(float _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(t[0]), cimag(t[0])); ++ printf("%0.20f + %0.20fi\n", creal(t[1]), cimag(t[1])); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func025.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func025.c +new file mode 100644 +index 0000000..12b9abb +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func025.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(double _Complex *t) { ++ printf("%20lf + %20lfi\n", creal(t[0]), cimag(t[0])); ++ printf("%20lf + %20lfi\n", creal(t[1]), cimag(t[1])); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func026.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func026.c +new file mode 100644 +index 0000000..78011d4 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func026.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(long double _Complex *t) { ++ printf("%20f + %20fi\n", creal(t[0]), cimag(t[0])); ++ printf("%20f + %20fi\n", creal(t[1]), cimag(t[1])); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func027.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func027.c +new file mode 100644 +index 0000000..91a49b5 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func027.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(_Bool *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/c_func028.c b/test/interoperability_with_c/005_fortran_call_c_array/c_func028.c +new file mode 100644 +index 0000000..9335307 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/c_func028.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(char *a) { ++ printf("%c\n", a[0]); ++ printf("%c\n", a[1]); ++} +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main001.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main001.f90 +new file mode 100644 +index 0000000..6e1f16f +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main001.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is int ++! ++program main ++ integer :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main002.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main002.f90 +new file mode 100644 +index 0000000..50f36f6 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main002.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is short ++! ++program main ++ integer(2) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(2) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main003.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main003.f90 +new file mode 100644 +index 0000000..5109bc3 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main003.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is long ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main004.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main004.f90 +new file mode 100644 +index 0000000..a4e1bc6 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main004.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the array type and the array type is ++! long long ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main005.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main005.f90 +new file mode 100644 +index 0000000..6f52cca +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main005.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the array type and the array type is ++! signed char ++! ++program main ++ integer(1) :: my_x(2) = 65 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main006.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main006.f90 +new file mode 100644 +index 0000000..3505849 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main006.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is size_t ++! ++program main ++ integer(8) :: my_x(2) = 3 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main007.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main007.f90 +new file mode 100644 +index 0000000..3ce82ad +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main007.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is int8_t ++! ++program main ++ integer(1) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main008.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main008.f90 +new file mode 100644 +index 0000000..12a52ee +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main008.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is int16_t ++! ++program main ++ integer(2) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(2) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main009.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main009.f90 +new file mode 100644 +index 0000000..139d7f9 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main009.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is int32_t ++! ++program main ++ integer(4) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(4) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main010.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main010.f90 +new file mode 100644 +index 0000000..81859b7 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main010.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is int64_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main011.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main011.f90 +new file mode 100644 +index 0000000..cee5bab +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main011.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least8_t ++! ++program main ++ integer(1) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main012.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main012.f90 +new file mode 100644 +index 0000000..fd005f2 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main012.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least16_t ++! ++program main ++ integer(2) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(2) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main013.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main013.f90 +new file mode 100644 +index 0000000..1fe884b +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main013.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least32_t ++! ++program main ++ integer(4) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(4) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main014.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main014.f90 +new file mode 100644 +index 0000000..ada1c56 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main014.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least64_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main015.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main015.f90 +new file mode 100644 +index 0000000..a025c8a +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main015.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast8_t ++! ++program main ++ integer(1) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(1) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main016.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main016.f90 +new file mode 100644 +index 0000000..d6d3f63 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main016.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast16_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main017.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main017.f90 +new file mode 100644 +index 0000000..851d06d +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main017.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast32_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main018.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main018.f90 +new file mode 100644 +index 0000000..9b62610 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main018.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast64_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main019.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main019.f90 +new file mode 100644 +index 0000000..41f77aa +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main019.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intmax_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main020.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main020.f90 +new file mode 100644 +index 0000000..3a48805 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main020.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intptr_t ++! ++program main ++ integer(8) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ integer(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main021.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main021.f90 +new file mode 100644 +index 0000000..86a9cf5 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main021.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is float ++! ++program main ++ real(4) :: my_x(2) = 12345678.7654321 ++ interface ++ subroutine c_func(b) ++ real(4) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main022.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main022.f90 +new file mode 100644 +index 0000000..ad70ca5 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main022.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is double ++! ++program main ++ real(8) :: my_x(2) = 12345678.7654321 ++ interface ++ subroutine c_func(b) ++ real(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main023.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main023.f90 +new file mode 100644 +index 0000000..e44608b +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the array type and the array type is ++! long double ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x(2) = 12345678.7654321 ++ interface ++ subroutine c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main024.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main024.f90 +new file mode 100644 +index 0000000..19df422 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main024.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the array type and the array type is ++! float _Complex ++! ++program main ++ complex(4) :: my_x(2) = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ complex(4) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main025.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main025.f90 +new file mode 100644 +index 0000000..b335a51 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main025.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the array type and the array type is ++! double _Complex ++! ++program main ++ complex(8) :: my_x(2) = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ complex(8) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main026.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main026.f90 +new file mode 100644 +index 0000000..7482ce8 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main026.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the array type and the array type is ++! long double _Complex ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x(2) = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main027.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main027.f90 +new file mode 100644 +index 0000000..d3249d1 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main027.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is _Bool ++! ++program main ++ logical(1) :: my_x(2) = .TRUE. ++ interface ++ subroutine c_func(b) ++ logical(1) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/fortran_main028.f90 b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main028.f90 +new file mode 100644 +index 0000000..a854e09 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/fortran_main028.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for the array type and the array type is char ++! ++program main ++ character(1) :: my_x(2) = 'a' ++ interface ++ subroutine c_func(b) ++ character(1) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/005_fortran_call_c_array/run.sh b/test/interoperability_with_c/005_fortran_call_c_array/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/005_fortran_call_c_array/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func001.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func001.c +new file mode 100644 +index 0000000..c7cf73f +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func001.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(int *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func002.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func002.c +new file mode 100644 +index 0000000..010cdf7 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func002.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(short *a) { ++ printf("%hd\n", a[0]); ++ printf("%hd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func003.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func003.c +new file mode 100644 +index 0000000..5e69081 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func003.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(long *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func004.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func004.c +new file mode 100644 +index 0000000..3f74c8e +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func004.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(long long *a) { ++ printf("%lld\n", a[0]); ++ printf("%lld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func005.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func005.c +new file mode 100644 +index 0000000..77794d4 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func005.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(signed char *a) { ++ printf("%c\n", a[0]); ++ printf("%c\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func006.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func006.c +new file mode 100644 +index 0000000..27c475f +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func006.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(size_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func007.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func007.c +new file mode 100644 +index 0000000..f7c4384 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func007.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int8_t *a) { ++ printf("%hhd\n", a[0]); ++ printf("%hhd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func008.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func008.c +new file mode 100644 +index 0000000..e29971f +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func008.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int16_t *a) { ++ printf("%hd\n", a[0]); ++ printf("%hd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func009.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func009.c +new file mode 100644 +index 0000000..3b84c1a +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func009.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int32_t *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func010.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func010.c +new file mode 100644 +index 0000000..11ca3e1 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func010.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int64_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func011.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func011.c +new file mode 100644 +index 0000000..f830d74 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func011.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least8_t *a) { ++ printf("%hhd\n", a[0]); ++ printf("%hhd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func012.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func012.c +new file mode 100644 +index 0000000..6ffd7e3 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func012.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least16_t *a) { ++ printf("%hd\n", a[0]); ++ printf("%hd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func013.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func013.c +new file mode 100644 +index 0000000..4b367cb +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func013.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least32_t *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func014.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func014.c +new file mode 100644 +index 0000000..6b2d5b3 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func014.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_least64_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func015.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func015.c +new file mode 100644 +index 0000000..81d223a +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func015.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast8_t *a) { ++ printf("%hhd\n", a[0]); ++ printf("%hhd\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func016.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func016.c +new file mode 100644 +index 0000000..297be3a +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func016.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast16_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func017.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func017.c +new file mode 100644 +index 0000000..8eb5818 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func017.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast32_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func018.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func018.c +new file mode 100644 +index 0000000..030b1f7 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func018.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(int_fast64_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func019.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func019.c +new file mode 100644 +index 0000000..babfc75 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func019.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(intmax_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func020.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func020.c +new file mode 100644 +index 0000000..26c7726 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func020.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(intptr_t *a) { ++ printf("%ld\n", a[0]); ++ printf("%ld\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func021.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func021.c +new file mode 100644 +index 0000000..a73f11b +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func021.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(float *a) { ++ printf("%f\n", a[0]); ++ printf("%f\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func022.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func022.c +new file mode 100644 +index 0000000..b600f94 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func022.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(double *a) { ++ printf("%0.20lf\n", a[0]); ++ printf("%0.20lf\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func023.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func023.c +new file mode 100644 +index 0000000..b34c388 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func023.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(long double *a) { ++ printf("%.20Lf\n", a[0]); ++ printf("%.20Lf\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func024.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func024.c +new file mode 100644 +index 0000000..1d34f02 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func024.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(float _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(t[0]), cimag(t[0])); ++ printf("%0.20f + %0.20fi\n", creal(t[1]), cimag(t[1])); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func025.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func025.c +new file mode 100644 +index 0000000..582096e +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func025.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(t[0]), cimag(t[0])); ++ printf("%0.20lf + %0.20lfi\n", creal(t[1]), cimag(t[1])); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func026.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func026.c +new file mode 100644 +index 0000000..b665220 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func026.c +@@ -0,0 +1,6 @@ ++#include ++#include ++void c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(t[0]), cimag(t[0])); ++ printf("%0.20f + %0.20fi\n", creal(t[1]), cimag(t[1])); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func027.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func027.c +new file mode 100644 +index 0000000..91a49b5 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func027.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(_Bool *a) { ++ printf("%d\n", a[0]); ++ printf("%d\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func028.c b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func028.c +new file mode 100644 +index 0000000..9335307 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/c_func028.c +@@ -0,0 +1,5 @@ ++#include ++void c_func_(char *a) { ++ printf("%c\n", a[0]); ++ printf("%c\n", a[1]); ++} +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main001.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main001.f90 +new file mode 100644 +index 0000000..c1c866f +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main001.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is int ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main002.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main002.f90 +new file mode 100644 +index 0000000..cb9976e +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main002.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is short ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_SHORT) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_SHORT) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main003.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main003.f90 +new file mode 100644 +index 0000000..fd935af +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main003.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is long ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_LONG) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_LONG) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main004.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main004.f90 +new file mode 100644 +index 0000000..fd72ea7 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main004.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long long with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_LONG_LONG) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_LONG_LONG) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main005.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main005.f90 +new file mode 100644 +index 0000000..f6e923d +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main005.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! signed char with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_SIGNED_CHAR) :: my_x(2) = 65 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_SIGNED_CHAR) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main006.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main006.f90 +new file mode 100644 +index 0000000..421534d +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main006.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is size_t ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_SIZE_T) :: my_x(2) = 3 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_SIZE_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main007.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main007.f90 +new file mode 100644 +index 0000000..d7b5b93 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main007.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is int8_t ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT8_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT8_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main008.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main008.f90 +new file mode 100644 +index 0000000..d7f7492 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main008.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int16_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT16_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT16_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main009.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main009.f90 +new file mode 100644 +index 0000000..35233f5 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main009.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int32_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT32_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT32_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main010.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main010.f90 +new file mode 100644 +index 0000000..f0c5cb2 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main010.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int64_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT64_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT64_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main011.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main011.f90 +new file mode 100644 +index 0000000..9b6e534 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main011.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least_8_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST8_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST8_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main012.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main012.f90 +new file mode 100644 +index 0000000..d0b4d29 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main012.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least16_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST16_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST16_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main013.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main013.f90 +new file mode 100644 +index 0000000..74e2a82 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main013.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least32_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST32_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST32_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main014.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main014.f90 +new file mode 100644 +index 0000000..09830a3 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main014.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_least64_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_LEAST64_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_LEAST64_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main015.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main015.f90 +new file mode 100644 +index 0000000..0663936 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main015.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast8_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST8_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST8_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main016.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main016.f90 +new file mode 100644 +index 0000000..3ed798b +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main016.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast16_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST16_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST16_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main017.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main017.f90 +new file mode 100644 +index 0000000..ad04f7a +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main017.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast32_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST32_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST32_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main018.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main018.f90 +new file mode 100644 +index 0000000..21bccab +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main018.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! int_fast64_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INT_FAST64_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INT_FAST64_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main019.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main019.f90 +new file mode 100644 +index 0000000..0ec82b6 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main019.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intmax_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INTMAX_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INTMAX_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main020.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main020.f90 +new file mode 100644 +index 0000000..dabd45d +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main020.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! intptr_t with iso_c_binding ++! ++program main ++ use iso_c_binding ++ integer(C_INTPTR_T) :: my_x(2) = 1 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ integer(C_INTPTR_T) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main021.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main021.f90 +new file mode 100644 +index 0000000..e0b4407 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main021.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is float ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ real(C_FLOAT) :: my_x(2) = 12345678.7654321 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ real(C_FLOAT) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main022.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main022.f90 +new file mode 100644 +index 0000000..453383e +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main022.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is double ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ real(C_DOUBLE) :: my_x(2) = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ real(C_DOUBLE) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main023.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main023.f90 +new file mode 100644 +index 0000000..527cb8a +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long double with iso_c_binding ++! ++program main ++ use iso_c_binding ++ real(C_LONG_DOUBLE) :: my_x(2) = 3.14159265358979 ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ real(C_LONG_DOUBLE) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main024.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main024.f90 +new file mode 100644 +index 0000000..a1d726f +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main024.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! float _Complex with iso_c_binding ++! ++program main ++ use iso_c_binding ++ complex(C_FLOAT_COMPLEX) :: my_x(2) = (-12345678.7654321, 1) ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ complex(C_FLOAT_COMPLEX) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main025.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main025.f90 +new file mode 100644 +index 0000000..d8e8d58 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main025.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! double _Complex with iso_c_binding ++! ++program main ++ use iso_c_binding ++ complex(C_DOUBLE_COMPLEX) :: my_x(2) = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ complex(C_DOUBLE_COMPLEX) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main026.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main026.f90 +new file mode 100644 +index 0000000..b90c2ce +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main026.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is ++! long double _Complex with iso_c_binding ++! ++program main ++ use iso_c_binding ++ complex(C_LONG_DOUBLE_COMPLEX) :: my_x(2) = (-3.14159265358979, 1) ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ complex(C_LONG_DOUBLE_COMPLEX) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main027.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main027.f90 +new file mode 100644 +index 0000000..ad4ac52 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main027.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is _Bool ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ logical(C_BOOL) :: my_x(2) = .FALSE. ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ logical(C_BOOL) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main028.f90 b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main028.f90 +new file mode 100644 +index 0000000..d7a220b +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/fortran_main028.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the scalar type and the scalar type is char ++! with iso_c_binding ++! ++program main ++ use iso_c_binding ++ character(C_CHAR) :: my_x(2) = 'a' ++ interface ++ subroutine c_func(b) ++ use iso_c_binding ++ character(C_CHAR) :: b(2) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/006_fortran_call_c_array_bindc/run.sh b/test/interoperability_with_c/006_fortran_call_c_array_bindc/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/006_fortran_call_c_array_bindc/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func001.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func001.c +new file mode 100644 +index 0000000..af6f0af +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func001.c +@@ -0,0 +1,8 @@ ++#include ++struct Ty { ++ int x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x[0]); ++ printf("%d\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func002.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func002.c +new file mode 100644 +index 0000000..8a69b38 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func002.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ short x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\t", t->x[0]); ++ printf("%hd\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func003.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func003.c +new file mode 100644 +index 0000000..2daf4d0 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func003.c +@@ -0,0 +1,8 @@ ++#include ++struct Ty { ++ long x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func004.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func004.c +new file mode 100644 +index 0000000..2dba23e +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func004.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long long x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lld\t", t->x[0]); ++ printf("%lld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func005.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func005.c +new file mode 100644 +index 0000000..3ff03dc +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func005.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ signed char x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%c\t", t->x[0]); ++ printf("%c\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func006.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func006.c +new file mode 100644 +index 0000000..15c7b76 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func006.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ size_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func007.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func007.c +new file mode 100644 +index 0000000..ab5a40e +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func007.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int8_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\t", t->x[0]); ++ printf("%hhd\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func008.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func008.c +new file mode 100644 +index 0000000..48e1926 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func008.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int16_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\t", t->x[0]); ++ printf("%hd\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func009.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func009.c +new file mode 100644 +index 0000000..0cb1972 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func009.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int32_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x[0]); ++ printf("%d\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func010.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func010.c +new file mode 100644 +index 0000000..c158eee +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func010.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int64_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func011.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func011.c +new file mode 100644 +index 0000000..7fb9f41 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func011.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least8_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\t", t->x[0]); ++ printf("%hhd\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func012.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func012.c +new file mode 100644 +index 0000000..1ab424d +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func012.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least16_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\t", t->x[0]); ++ printf("%hd\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func013.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func013.c +new file mode 100644 +index 0000000..98a7568 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func013.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least32_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x[0]); ++ printf("%d\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func014.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func014.c +new file mode 100644 +index 0000000..56cd691 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func014.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_least64_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func015.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func015.c +new file mode 100644 +index 0000000..91823ae +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func015.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast8_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\t", t->x[0]); ++ printf("%hhd\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func016.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func016.c +new file mode 100644 +index 0000000..99bd5f1 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func016.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast16_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func017.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func017.c +new file mode 100644 +index 0000000..51c3977 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func017.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast32_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func018.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func018.c +new file mode 100644 +index 0000000..575e915 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func018.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ int_fast64_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func019.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func019.c +new file mode 100644 +index 0000000..45f0beb +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func019.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ intmax_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func020.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func020.c +new file mode 100644 +index 0000000..553b51b +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func020.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ intptr_t x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\t", t->x[0]); ++ printf("%ld\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func021.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func021.c +new file mode 100644 +index 0000000..13cce4d +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func021.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ float x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f\t", t->x[0]); ++ printf("%f\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func022.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func022.c +new file mode 100644 +index 0000000..d1f7b9d +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func022.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ double x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lf\t", t->x[0]); ++ printf("%lf\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func023.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func023.c +new file mode 100644 +index 0000000..5f383b1 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func023.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long double x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%Lf\t", t->x[0]); ++ printf("%Lf\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func024.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func024.c +new file mode 100644 +index 0000000..65309d7 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func024.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ float _Complex x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->x[0]), cimag(t->x[0])); ++ printf("%f + %fi\n", creal(t->x[1]), cimag(t->x[1])); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func025.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func025.c +new file mode 100644 +index 0000000..b36c40e +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func025.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ double _Complex x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lf + %lfi\n", creal(t->x[0]), cimag(t->x[0])); ++ printf("%lf + %lfi\n", creal(t->x[1]), cimag(t->x[1])); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func026.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func026.c +new file mode 100644 +index 0000000..a7bcf01 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func026.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ long double _Complex x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->x[0]), cimag(t->x[0])); ++ printf("%f + %fi\n", creal(t->x[1]), cimag(t->x[1])); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func027.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func027.c +new file mode 100644 +index 0000000..5723427 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func027.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ _Bool x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\t", t->x[0]); ++ printf("%d\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func028.c b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func028.c +new file mode 100644 +index 0000000..47138e9 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/c_func028.c +@@ -0,0 +1,9 @@ ++#include ++#include ++struct Ty { ++ char x[2]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%c\t", t->x[0]); ++ printf("%c\n", t->x[1]); ++} +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main001.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main001.f90 +new file mode 100644 +index 0000000..6c8c711 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main001.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer :: x(2) = 1 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main002.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main002.f90 +new file mode 100644 +index 0000000..4c9f0b9 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main002.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type short without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(2) :: x(2) = -32768 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main003.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main003.f90 +new file mode 100644 +index 0000000..f8962b2 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main003.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type long without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main004.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main004.f90 +new file mode 100644 +index 0000000..1bdf578 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main004.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type long long without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main005.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main005.f90 +new file mode 100644 +index 0000000..b8d6d20 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main005.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type signed char without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x(2) = 65 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main006.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main006.f90 +new file mode 100644 +index 0000000..24f4d74 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main006.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type size_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = 0 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main007.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main007.f90 +new file mode 100644 +index 0000000..4c868b3 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main007.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int8_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x(2) = -128 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main008.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main008.f90 +new file mode 100644 +index 0000000..0fd89db +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main008.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int16_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(2) :: x(2) = -32768 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main009.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main009.f90 +new file mode 100644 +index 0000000..2dee9f6 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main009.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int32_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(4) :: x(2) = -2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main010.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main010.f90 +new file mode 100644 +index 0000000..60b3af9 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main010.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int64_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main011.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main011.f90 +new file mode 100644 +index 0000000..2ac8242 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main011.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_least8_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x(2) = -128 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main012.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main012.f90 +new file mode 100644 +index 0000000..50c6ca8 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main012.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_least16_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(2) :: x(2) = -32768 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main013.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main013.f90 +new file mode 100644 +index 0000000..ff3b140 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main013.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_least32_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(4) :: x(2) = -2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main014.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main014.f90 +new file mode 100644 +index 0000000..366a7a3 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main014.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_least64_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main015.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main015.f90 +new file mode 100644 +index 0000000..654302d +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main015.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_fast8_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(1) :: x(2) = -128 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main016.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main016.f90 +new file mode 100644 +index 0000000..78727d9 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main016.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_fast16_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -32768 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main017.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main017.f90 +new file mode 100644 +index 0000000..122b60d +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main017.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_fast32_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -2147483647 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main018.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main018.f90 +new file mode 100644 +index 0000000..245cca8 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main018.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type int_fast64_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main019.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main019.f90 +new file mode 100644 +index 0000000..f46b68f +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main019.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type intmax_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main020.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main020.f90 +new file mode 100644 +index 0000000..21ec77a +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main020.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type intptr_t without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ integer(8) :: x(2) = -9223372036854775807 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main021.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main021.f90 +new file mode 100644 +index 0000000..fe827d4 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main021.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type float without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ real(4) :: x(2) = 3.14 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main022.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main022.f90 +new file mode 100644 +index 0000000..55bd7d1 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main022.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type double without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ real(8) :: x(2) = 450359962737049.621345 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main023.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main023.f90 +new file mode 100644 +index 0000000..8f17598 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main023.f90 +@@ -0,0 +1,17 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type long double without iso_c_binding ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: t ++ real(K) :: x(2) = 450359962737049.621345 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main024.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main024.f90 +new file mode 100644 +index 0000000..635ac18 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main024.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type float _Complex without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ complex(4) :: x(2) = (-3, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main025.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main025.f90 +new file mode 100644 +index 0000000..66ec48b +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main025.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type double _Complex without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ complex(8) :: x(2) = (-3, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main026.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main026.f90 +new file mode 100644 +index 0000000..304647b +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main026.f90 +@@ -0,0 +1,18 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type long double _Complex without ++! iso_c_binding ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: t ++ complex(K) :: x(2) = (-3.1415926, 1.654) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main027.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main027.f90 +new file mode 100644 +index 0000000..e454591 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main027.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type _Bool without iso_c_binding ++! ++ type, bind(c) :: t ++ logical(1) :: x(2) = .TRUE. ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main028.f90 b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main028.f90 +new file mode 100644 +index 0000000..e2ee053 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/fortran_main028.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of type char without iso_c_binding ++! ++program main ++ type, bind(c) :: t ++ character :: x(2) = 'b' ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/007_fortran_call_c_array_struct/run.sh b/test/interoperability_with_c/007_fortran_call_c_array_struct/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/007_fortran_call_c_array_struct/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func001.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func001.c +new file mode 100644 +index 0000000..6535dd7 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func001.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func002.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func002.c +new file mode 100644 +index 0000000..e9bb160 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func002.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ short j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func003.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func003.c +new file mode 100644 +index 0000000..99c95b0 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func003.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ long j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func004.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func004.c +new file mode 100644 +index 0000000..69a1176 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func004.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ long long j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func005.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func005.c +new file mode 100644 +index 0000000..d5e28b1 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func005.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ signed char j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%c\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func006.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func006.c +new file mode 100644 +index 0000000..542ddbc +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func006.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ size_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func007.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func007.c +new file mode 100644 +index 0000000..71ceb1c +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func007.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int8_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func008.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func008.c +new file mode 100644 +index 0000000..b6489b2 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func008.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int16_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func009.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func009.c +new file mode 100644 +index 0000000..7ba6646 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func009.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int32_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func010.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func010.c +new file mode 100644 +index 0000000..672e95b +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func010.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int64_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func011.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func011.c +new file mode 100644 +index 0000000..802995a +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func011.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_least8_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func012.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func012.c +new file mode 100644 +index 0000000..bcc8dbd +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func012.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_least16_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hd\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func013.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func013.c +new file mode 100644 +index 0000000..4688138 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func013.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_least32_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func014.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func014.c +new file mode 100644 +index 0000000..1c30ccc +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func014.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_least64_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func015.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func015.c +new file mode 100644 +index 0000000..0d3e522 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func015.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_fast8_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%hhd\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func016.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func016.c +new file mode 100644 +index 0000000..e98a73b +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func016.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_fast16_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func017.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func017.c +new file mode 100644 +index 0000000..ef890d5 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func017.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_fast32_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func018.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func018.c +new file mode 100644 +index 0000000..4eb17aa +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func018.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ int_fast64_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func019.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func019.c +new file mode 100644 +index 0000000..e88ed31 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func019.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ intmax_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func020.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func020.c +new file mode 100644 +index 0000000..8a50887 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func020.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ intptr_t j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%ld\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func021.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func021.c +new file mode 100644 +index 0000000..c8f6dac +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func021.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ float j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.2f\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func022.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func022.c +new file mode 100644 +index 0000000..72ce135 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func022.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ double j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.2f\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func023.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func023.c +new file mode 100644 +index 0000000..b3f0db5 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func023.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ long double j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.2Lf\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func024.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func024.c +new file mode 100644 +index 0000000..315c5c4 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func024.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ float _Complex j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->bt.j), cimag(t->bt.j)); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func025.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func025.c +new file mode 100644 +index 0000000..4bfcf58 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func025.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ double _Complex j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.20lf + %.20lfi\n", creal(t->bt.j), cimag(t->bt.j)); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func026.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func026.c +new file mode 100644 +index 0000000..40b4a7b +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func026.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ long double _Complex j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->bt.j), cimag(t->bt.j)); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func027.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func027.c +new file mode 100644 +index 0000000..5614736 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func027.c +@@ -0,0 +1,10 @@ ++#include ++struct BaseTy { ++ _Bool j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t, _Bool *a) { ++ printf("%d\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func028.c b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func028.c +new file mode 100644 +index 0000000..82233e7 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/c_func028.c +@@ -0,0 +1,11 @@ ++#include ++#include ++struct BaseTy { ++ char j; ++}; ++struct Ty { ++ struct BaseTy bt; ++}; ++void c_func_(struct Ty *t) { ++ printf("%c\n", t->bt.j); ++} +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main001.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main001.f90 +new file mode 100644 +index 0000000..a87b80c +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main001.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int ++! ++program main ++ type, bind(c) :: base ++ integer :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main002.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main002.f90 +new file mode 100644 +index 0000000..eba5ed5 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main002.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of short ++! ++program main ++ type, bind(c) :: base ++ integer(2) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main003.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main003.f90 +new file mode 100644 +index 0000000..73a5bcf +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main003.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of long ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main004.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main004.f90 +new file mode 100644 +index 0000000..55a915f +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main004.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of long long ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main005.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main005.f90 +new file mode 100644 +index 0000000..2531e8c +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main005.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of signed char ++! ++program main ++ type, bind(c) :: base ++ integer(1) :: j = 65 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main006.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main006.f90 +new file mode 100644 +index 0000000..c9ae956 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main006.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of size_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = 0 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main007.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main007.f90 +new file mode 100644 +index 0000000..c864163 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main007.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int8_t ++! ++program main ++ type, bind(c) :: base ++ integer(1) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main008.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main008.f90 +new file mode 100644 +index 0000000..4adf5fe +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main008.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int16_t ++! ++program main ++ type, bind(c) :: base ++ integer(2) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main009.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main009.f90 +new file mode 100644 +index 0000000..57b4035 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main009.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int32_t ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main010.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main010.f90 +new file mode 100644 +index 0000000..0183cad +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main010.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int64_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main011.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main011.f90 +new file mode 100644 +index 0000000..7b5942f +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main011.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_least_8 ++! ++program main ++ type, bind(c) :: base ++ integer(1) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main012.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main012.f90 +new file mode 100644 +index 0000000..44c8378 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main012.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_least16_t ++! ++program main ++ type, bind(c) :: base ++ integer(2) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main013.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main013.f90 +new file mode 100644 +index 0000000..f3e8018 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main013.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_least32_t ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main014.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main014.f90 +new file mode 100644 +index 0000000..143d75e +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main014.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_least64_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main015.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main015.f90 +new file mode 100644 +index 0000000..ded38dd +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main015.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_fast8_t ++! ++program main ++ type, bind(c) :: base ++ integer(1) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main016.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main016.f90 +new file mode 100644 +index 0000000..79d6f7f +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main016.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_fast16_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main017.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main017.f90 +new file mode 100644 +index 0000000..b48cc58 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main017.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_fast32_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main018.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main018.f90 +new file mode 100644 +index 0000000..82878b7 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main018.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of int_fast64_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main019.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main019.f90 +new file mode 100644 +index 0000000..b60089f +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main019.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of intmax_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main020.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main020.f90 +new file mode 100644 +index 0000000..277b313 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main020.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of intptr_t ++! ++program main ++ type, bind(c) :: base ++ integer(8) :: j = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main021.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main021.f90 +new file mode 100644 +index 0000000..a191c0d +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main021.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of float ++! ++program main ++ type, bind(c) :: base ++ real(4) :: j = -2.36 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main022.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main022.f90 +new file mode 100644 +index 0000000..e8df525 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main022.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of float ++! ++program main ++ type, bind(c) :: base ++ real(8) :: j = -2.36 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main023.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main023.f90 +new file mode 100644 +index 0000000..90e2060 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main023.f90 +@@ -0,0 +1,21 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of long double ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: base ++ real(K) :: j = -2.36 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main024.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main024.f90 +new file mode 100644 +index 0000000..a5a051a +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main024.f90 +@@ -0,0 +1,21 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of float _Complex ++! ++program main ++ type, bind(c) :: base ++ complex(4) :: j = (1, 2); ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main025.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main025.f90 +new file mode 100644 +index 0000000..be78fcc +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main025.f90 +@@ -0,0 +1,21 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of double _Complex ++! ++program main ++ type, bind(c) :: base ++ complex(8) :: j = (1, 2); ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main026.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main026.f90 +new file mode 100644 +index 0000000..6d7c710 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main026.f90 +@@ -0,0 +1,22 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of long double _Complex ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: base ++ complex(K) :: j = (1, 2); ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main027.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main027.f90 +new file mode 100644 +index 0000000..ed52db7 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main027.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of _Bool ++! ++program main ++ type, bind(c) :: base ++ logical(1) :: j = .TRUE. ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main028.f90 b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main028.f90 +new file mode 100644 +index 0000000..7bd346a +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/fortran_main028.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type the other component of derived type is ++! scalar type of char ++! ++program main ++ type, bind(c) :: base ++ character(1) :: j = 'a' ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/run.sh b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/008_fortran-call-C-nested-struct-simple/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func001.c b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func001.c +new file mode 100644 +index 0000000..111e43b +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func001.c +@@ -0,0 +1,16 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int n[4]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->bt.j); ++ printf("%d\n", t->n[0]); ++ printf("%d\n", t->n[0]+t->bt.j); ++ printf("%d\n", t->n[1]); ++ printf("%d\n", t->n[2]); ++ printf("%d\n", t->n[3]); ++} +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func002.c b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func002.c +new file mode 100644 +index 0000000..c1df231 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func002.c +@@ -0,0 +1,22 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int n[4]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t[0].bt.j); ++ printf("%d\n", t[0].n[0]); ++ printf("%d\n", t[0].n[0]+t->bt.j); ++ printf("%d\n", t[0].n[1]); ++ printf("%d\n", t[0].n[2]); ++ printf("%d\n", t[0].n[3]); ++ printf("%d\n", t[1].bt.j); ++ printf("%d\n", t[1].n[0]); ++ printf("%d\n", t[1].n[0]+t->bt.j); ++ printf("%d\n", t[1].n[1]); ++ printf("%d\n", t[1].n[2]); ++ printf("%d\n", t[1].n[3]); ++} +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func003.c b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func003.c +new file mode 100644 +index 0000000..8d0298b +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func003.c +@@ -0,0 +1,23 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty1 { ++ struct BaseTy bt; ++ int k; ++}; ++struct Ty { ++ struct BaseTy bt; ++ struct Ty1 yt; ++ int n[4]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->bt.j); ++ printf("%d\n", t->n[0]); ++ printf("%d\n", t->n[0]+t->bt.j); ++ printf("%d\n", t->n[1]); ++ printf("%d\n", t->n[2]); ++ printf("%d\n", t->n[3]); ++ printf("%d\n", t->yt.k); ++ printf("%d\n", t->yt.bt.j); ++} +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func004.c b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func004.c +new file mode 100644 +index 0000000..ff232d9 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func004.c +@@ -0,0 +1,30 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty1 { ++ struct BaseTy bt; ++ int k1; ++}; ++struct Ty2 { ++ struct Ty1 bty1; ++ int k2; ++}; ++struct Ty3 { ++ struct Ty2 bty2; ++ int k3; ++}; ++struct Ty { ++ struct Ty3 yt; ++ int n[4]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->n[0]); ++ printf("%d\n", t->n[1]); ++ printf("%d\n", t->n[2]); ++ printf("%d\n", t->n[3]); ++ printf("%d\n", t->yt.k3); ++ printf("%d\n", t->yt.bty2.k2); ++ printf("%d\n", t->yt.bty2.bty1.k1); ++ printf("%d\n", t->yt.bty2.bty1.bt.j); ++} +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func005.c b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func005.c +new file mode 100644 +index 0000000..9cff8b8 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func005.c +@@ -0,0 +1,18 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty { ++ struct BaseTy bt[3]; ++ int n[4]; ++}; ++void c_func_(struct Ty *t) { ++ printf("%d\n", t->bt[0].j); ++ printf("%d\n", t->bt[1].j); ++ printf("%d\n", t->bt[2].j); ++ printf("%d\n", t->n[0]); ++ printf("%d\n", t->n[0]+t->bt[0].j); ++ printf("%d\n", t->n[1]); ++ printf("%d\n", t->n[2]); ++ printf("%d\n", t->n[3]); ++} +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func006.c b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func006.c +new file mode 100644 +index 0000000..6bd160d +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/c_func006.c +@@ -0,0 +1,19 @@ ++#include ++struct BaseTy { ++ int j; ++}; ++struct Ty { ++ struct BaseTy bt[3]; ++ int n[4]; ++}; ++struct Ty* c_func_(struct Ty *t) { ++ printf("%d\n", t->bt[0].j); ++ printf("%d\n", t->bt[1].j); ++ printf("%d\n", t->bt[2].j); ++ printf("%d\n", t->n[0]); ++ printf("%d\n", t->n[0]+t->bt[0].j); ++ printf("%d\n", t->n[1]); ++ printf("%d\n", t->n[2]); ++ printf("%d\n", t->n[3]); ++ return t; ++} +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main001.f90 b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main001.f90 +new file mode 100644 +index 0000000..2647a97 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main001.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is derived type ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -1 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(4) :: i(4) = 1 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main002.f90 b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main002.f90 +new file mode 100644 +index 0000000..edf7112 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main002.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the array of derived type and the component ++! of the derived type is derived type ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -1 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(4) :: i(4) = 1 ++ end type t ++ type(t) :: my_t(2) ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a(2) ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main003.f90 b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main003.f90 +new file mode 100644 +index 0000000..e0d5848 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main003.f90 +@@ -0,0 +1,25 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type are derived types ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -1 ++ end type base ++ type, bind(c) :: base2 ++ type(base) :: bt ++ integer(4) :: k = 256 ++ end type base2 ++ type, bind(c) :: t ++ type(base) :: bt ++ type(base2) :: yt ++ integer(4) :: i(4) = 1 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main004.f90 b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main004.f90 +new file mode 100644 +index 0000000..66e62eb +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main004.f90 +@@ -0,0 +1,31 @@ ++! Test fortran call c for the nesting of derived types ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -1 ++ end type base ++ type, bind(c) :: base1 ++ type(base) :: bt1 ++ integer(4) :: k1 = 256 ++ end type base1 ++ type, bind(c) :: base2 ++ type(base1) :: bt2 ++ integer(4) :: k2 = 257 ++ end type base2 ++ type, bind(c) :: base3 ++ type(base2) :: bt3 ++ integer(4) :: k3 = 258 ++ end type base3 ++ type, bind(c) :: t ++ type(base3) :: yt ++ integer(4) :: i(4) = 1 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main005.f90 b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main005.f90 +new file mode 100644 +index 0000000..60cd8ac +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main005.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the derived type and the component of the ++! derived type is array of derived type ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -1 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt(3) ++ integer(4) :: i(4) = 1 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main006.f90 b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main006.f90 +new file mode 100644 +index 0000000..36ef4a9 +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/fortran_main006.f90 +@@ -0,0 +1,20 @@ ++! Test fortran call c for the return type is derived type ++! ++program main ++ type, bind(c) :: base ++ integer(4) :: j = -1 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt(3) ++ integer(4) :: i(4) = 1 ++ end type t ++ type(t) :: my_t ++ interface ++ function c_func(a) result(res) bind(c, name = "c_func_") ++ import :: t ++ type(t) :: a ++ type(t), pointer :: res ++ end ++ end interface ++ print *, c_func(my_t) ++end +diff --git a/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/run.sh b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/run.sh +new file mode 100644 +index 0000000..5ad075b +--- /dev/null ++++ b/test/interoperability_with_c/009_fortran-call-C-nested-struct-complicated/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..006} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func001.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func001.c +new file mode 100644 +index 0000000..89defd9 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func001.c +@@ -0,0 +1,5 @@ ++#include ++int* c_func_(int *a) { ++ printf("%5d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func002.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func002.c +new file mode 100644 +index 0000000..0239f18 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++short* c_func_(short *a) { ++ printf("%5hd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func003.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func003.c +new file mode 100644 +index 0000000..b1b4838 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++long* c_func_(long *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func004.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func004.c +new file mode 100644 +index 0000000..90896f0 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++long long* c_func_(long long *a) { ++ printf("%lld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func005.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func005.c +new file mode 100644 +index 0000000..91e7d0d +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func005.c +@@ -0,0 +1,5 @@ ++#include ++signed char* c_func_(signed char *a) { ++ printf("%5c\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func006.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func006.c +new file mode 100644 +index 0000000..13ec31a +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func006.c +@@ -0,0 +1,6 @@ ++#include ++#include ++size_t* c_func_(size_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func007.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func007.c +new file mode 100644 +index 0000000..e883fd3 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func007.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int8_t* c_func_(int8_t *a) { ++ printf("%5hhd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func008.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func008.c +new file mode 100644 +index 0000000..a8a3209 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func008.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int16_t* c_func_(int16_t *a) { ++ printf("%5hd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func009.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func009.c +new file mode 100644 +index 0000000..9ad7e76 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func009.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int32_t* c_func_(int32_t *a) { ++ printf("%5d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func010.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func010.c +new file mode 100644 +index 0000000..6bff1b5 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func010.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int64_t* c_func_(int64_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func011.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func011.c +new file mode 100644 +index 0000000..4a5970a +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func011.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least8_t* c_func_(int_least8_t *a) { ++ printf("%5hhd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func012.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func012.c +new file mode 100644 +index 0000000..72ac1a4 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func012.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least16_t* c_func_(int_least16_t *a) { ++ printf("%5hd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func013.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func013.c +new file mode 100644 +index 0000000..771e48b +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func013.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least32_t* c_func_(int_least32_t *a) { ++ printf("%d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func014.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func014.c +new file mode 100644 +index 0000000..c782984 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func014.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least64_t* c_func_(int_least64_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func015.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func015.c +new file mode 100644 +index 0000000..96452b1 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func015.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast8_t* c_func_(int_fast8_t *a) { ++ printf("%5hhd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func016.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func016.c +new file mode 100644 +index 0000000..27bac38 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func016.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast16_t* c_func_(int_fast16_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func017.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func017.c +new file mode 100644 +index 0000000..f4e0e76 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func017.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast32_t* c_func_(int_fast32_t *a) { ++ printf("%ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func018.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func018.c +new file mode 100644 +index 0000000..ee80d9a +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func018.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast64_t* c_func_(int_fast64_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func019.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func019.c +new file mode 100644 +index 0000000..a6205df +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func019.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intmax_t* c_func_(intmax_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func020.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func020.c +new file mode 100644 +index 0000000..3fc6c40 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func020.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intptr_t* c_func_(intptr_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func021.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func021.c +new file mode 100644 +index 0000000..4584a17 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func021.c +@@ -0,0 +1,5 @@ ++#include ++float* c_func_(float *a) { ++ printf("%0.20f\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func022.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func022.c +new file mode 100644 +index 0000000..6c20627 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func022.c +@@ -0,0 +1,5 @@ ++#include ++double* c_func_(double *a) { ++ printf("%0.20lf\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func023.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func023.c +new file mode 100644 +index 0000000..4067c00 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func023.c +@@ -0,0 +1,5 @@ ++#include ++long double* c_func_(long double *a) { ++ printf("%0.20Lf\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func024.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func024.c +new file mode 100644 +index 0000000..8d5cbd6 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func024.c +@@ -0,0 +1,6 @@ ++#include ++#include ++float _Complex* c_func_(float _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return t; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func025.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func025.c +new file mode 100644 +index 0000000..2cc6c66 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func025.c +@@ -0,0 +1,6 @@ ++#include ++#include ++double _Complex* c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(*t), cimag(*t)); ++ return t; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func026.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func026.c +new file mode 100644 +index 0000000..4cd06f9 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func026.c +@@ -0,0 +1,6 @@ ++#include ++#include ++long double _Complex* c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return t; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func027.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func027.c +new file mode 100644 +index 0000000..d576c9e +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func027.c +@@ -0,0 +1,5 @@ ++#include ++_Bool* c_func_(_Bool *a) { ++ printf("%5d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func028.c b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func028.c +new file mode 100644 +index 0000000..d453743 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/c_func028.c +@@ -0,0 +1,6 @@ ++#include ++#include ++char* c_func_(char *t) { ++ printf("%c\n", *t); ++ return t; ++} +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main001.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main001.f90 +new file mode 100644 +index 0000000..eea8ab6 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main001.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int with bindc ++! ++program main ++ integer :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer :: b ++ integer, pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main002.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main002.f90 +new file mode 100644 +index 0000000..75ae05d +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main002.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type short with ++! bindc ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(2) :: b ++ integer(2), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main003.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main003.f90 +new file mode 100644 +index 0000000..0ddcedf +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main003.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type long with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main004.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main004.f90 +new file mode 100644 +index 0000000..7383644 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main004.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type long long with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main005.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main005.f90 +new file mode 100644 +index 0000000..641ec2f +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main005.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type signed char ++! with bindc ++! ++program main ++ integer(1) :: my_x = 65 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main006.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main006.f90 +new file mode 100644 +index 0000000..f5776ff +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main006.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type size_t with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main007.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main007.f90 +new file mode 100644 +index 0000000..9c8f25b +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main007.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int8_t with ++! bindc ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main008.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main008.f90 +new file mode 100644 +index 0000000..e057058 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main008.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int16_t with ++! bindc ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(2) :: b ++ integer(2), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main009.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main009.f90 +new file mode 100644 +index 0000000..e9c35c1 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main009.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int32_t with ++! bindc ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(4) :: b ++ integer(4), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main010.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main010.f90 +new file mode 100644 +index 0000000..d52b3f0 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main010.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int64_t with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main011.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main011.f90 +new file mode 100644 +index 0000000..8427950 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main011.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_least8_t ++! with bindc ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main012.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main012.f90 +new file mode 100644 +index 0000000..123a9b1 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main012.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_least16_t ++! with bindc ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(2) :: b ++ integer(2), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main013.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main013.f90 +new file mode 100644 +index 0000000..a8586ed +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main013.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_least32_t ++! with bindc ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(4) :: b ++ integer(4), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main014.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main014.f90 +new file mode 100644 +index 0000000..6634cd9 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main014.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_least64_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main015.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main015.f90 +new file mode 100644 +index 0000000..75a9b48 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main015.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_fast8_t ++! with bindc ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main016.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main016.f90 +new file mode 100644 +index 0000000..58c20b5 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main016.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_fast16_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main017.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main017.f90 +new file mode 100644 +index 0000000..64ed1d0 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main017.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_fast32_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main018.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main018.f90 +new file mode 100644 +index 0000000..b7ad882 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main018.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type int_fast64_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main019.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main019.f90 +new file mode 100644 +index 0000000..1197ccb +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main019.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type intmax_t with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main020.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main020.f90 +new file mode 100644 +index 0000000..9bf210b +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main020.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type intptr_t with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main021.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main021.f90 +new file mode 100644 +index 0000000..debcb13 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main021.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type float with ++! bindc ++! ++program main ++ real(4) :: my_x = 1.0 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ real(4) :: b ++ real(4), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main022.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main022.f90 +new file mode 100644 +index 0000000..20c50dc +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main022.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type double with ++! bindc ++! ++program main ++ real(8) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ real(8) :: b ++ real(8), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main023.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main023.f90 +new file mode 100644 +index 0000000..db15fba +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main023.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the return type is ptr of type long double ++! with bindc ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: b ++ real(K), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main024.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main024.f90 +new file mode 100644 +index 0000000..418f3ef +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main024.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type float _Complex ++! with bindc ++! ++program main ++ complex(4) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ complex(4) :: b ++ complex(4), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main025.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main025.f90 +new file mode 100644 +index 0000000..d895ead +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main025.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type double ++! _Complex with bindc ++! ++program main ++ complex(8) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ complex(8) :: b ++ complex(8), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main026.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main026.f90 +new file mode 100644 +index 0000000..4a70cfe +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main026.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the return type is ptr of type long double ++! _Complex with bindc ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: b ++ complex(K), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main027.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main027.f90 +new file mode 100644 +index 0000000..7a59b51 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main027.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type _Bool with ++! bindc ++! ++program main ++ logical(1) :: my_x = .FALSE. ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ logical(1) :: b ++ logical(1), pointer :: res ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main028.f90 b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main028.f90 +new file mode 100644 +index 0000000..c76780f +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/fortran_main028.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type char with ++! bindc ++! ++program main ++ character(1) :: my_x = 'a' ++ interface ++ function c_func(b) result(res) bind(c, name = "c_func_") ++ character(1) :: b ++ character(1), pointer :: res ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/run.sh b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/010_fortran_call_c_function_ptr_bindc/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func001.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func001.c +new file mode 100644 +index 0000000..89defd9 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func001.c +@@ -0,0 +1,5 @@ ++#include ++int* c_func_(int *a) { ++ printf("%5d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func002.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func002.c +new file mode 100644 +index 0000000..0239f18 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++short* c_func_(short *a) { ++ printf("%5hd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func003.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func003.c +new file mode 100644 +index 0000000..b1b4838 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++long* c_func_(long *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func004.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func004.c +new file mode 100644 +index 0000000..90896f0 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++long long* c_func_(long long *a) { ++ printf("%lld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func005.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func005.c +new file mode 100644 +index 0000000..91e7d0d +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func005.c +@@ -0,0 +1,5 @@ ++#include ++signed char* c_func_(signed char *a) { ++ printf("%5c\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func006.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func006.c +new file mode 100644 +index 0000000..13ec31a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func006.c +@@ -0,0 +1,6 @@ ++#include ++#include ++size_t* c_func_(size_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func007.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func007.c +new file mode 100644 +index 0000000..e883fd3 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func007.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int8_t* c_func_(int8_t *a) { ++ printf("%5hhd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func008.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func008.c +new file mode 100644 +index 0000000..a8a3209 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func008.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int16_t* c_func_(int16_t *a) { ++ printf("%5hd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func009.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func009.c +new file mode 100644 +index 0000000..9ad7e76 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func009.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int32_t* c_func_(int32_t *a) { ++ printf("%5d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func010.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func010.c +new file mode 100644 +index 0000000..6bff1b5 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func010.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int64_t* c_func_(int64_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func011.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func011.c +new file mode 100644 +index 0000000..4a5970a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func011.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least8_t* c_func_(int_least8_t *a) { ++ printf("%5hhd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func012.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func012.c +new file mode 100644 +index 0000000..72ac1a4 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func012.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least16_t* c_func_(int_least16_t *a) { ++ printf("%5hd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func013.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func013.c +new file mode 100644 +index 0000000..771e48b +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func013.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least32_t* c_func_(int_least32_t *a) { ++ printf("%d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func014.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func014.c +new file mode 100644 +index 0000000..c782984 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func014.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least64_t* c_func_(int_least64_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func015.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func015.c +new file mode 100644 +index 0000000..96452b1 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func015.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast8_t* c_func_(int_fast8_t *a) { ++ printf("%5hhd\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func016.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func016.c +new file mode 100644 +index 0000000..27bac38 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func016.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast16_t* c_func_(int_fast16_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func017.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func017.c +new file mode 100644 +index 0000000..f4e0e76 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func017.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast32_t* c_func_(int_fast32_t *a) { ++ printf("%ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func018.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func018.c +new file mode 100644 +index 0000000..ee80d9a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func018.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast64_t* c_func_(int_fast64_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func019.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func019.c +new file mode 100644 +index 0000000..a6205df +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func019.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intmax_t* c_func_(intmax_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func020.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func020.c +new file mode 100644 +index 0000000..3fc6c40 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func020.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intptr_t* c_func_(intptr_t *a) { ++ printf("%5ld\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func021.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func021.c +new file mode 100644 +index 0000000..4584a17 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func021.c +@@ -0,0 +1,5 @@ ++#include ++float* c_func_(float *a) { ++ printf("%0.20f\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func022.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func022.c +new file mode 100644 +index 0000000..6c20627 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func022.c +@@ -0,0 +1,5 @@ ++#include ++double* c_func_(double *a) { ++ printf("%0.20lf\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func023.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func023.c +new file mode 100644 +index 0000000..4067c00 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func023.c +@@ -0,0 +1,5 @@ ++#include ++long double* c_func_(long double *a) { ++ printf("%0.20Lf\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func024.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func024.c +new file mode 100644 +index 0000000..8d5cbd6 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func024.c +@@ -0,0 +1,6 @@ ++#include ++#include ++float _Complex* c_func_(float _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return t; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func025.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func025.c +new file mode 100644 +index 0000000..2cc6c66 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func025.c +@@ -0,0 +1,6 @@ ++#include ++#include ++double _Complex* c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(*t), cimag(*t)); ++ return t; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func026.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func026.c +new file mode 100644 +index 0000000..4cd06f9 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func026.c +@@ -0,0 +1,6 @@ ++#include ++#include ++long double _Complex* c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return t; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func027.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func027.c +new file mode 100644 +index 0000000..d576c9e +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func027.c +@@ -0,0 +1,5 @@ ++#include ++_Bool* c_func_(_Bool *a) { ++ printf("%5d\n", *a); ++ return a; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func028.c b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func028.c +new file mode 100644 +index 0000000..d453743 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/c_func028.c +@@ -0,0 +1,6 @@ ++#include ++#include ++char* c_func_(char *t) { ++ printf("%c\n", *t); ++ return t; ++} +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main001.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main001.f90 +new file mode 100644 +index 0000000..0162f22 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main001.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int ++! ++program main ++ integer :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer :: b ++ integer, pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main002.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main002.f90 +new file mode 100644 +index 0000000..9398800 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main002.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type short ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(2) :: b ++ integer(2), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main003.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main003.f90 +new file mode 100644 +index 0000000..8905eab +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main003.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type long ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main004.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main004.f90 +new file mode 100644 +index 0000000..6ce9768 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main004.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type long long ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main005.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main005.f90 +new file mode 100644 +index 0000000..9445938 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main005.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type signed char ++! ++program main ++ integer(1) :: my_x = 65 ++ interface ++ function c_func(b) result(res) ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main006.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main006.f90 +new file mode 100644 +index 0000000..7ead44f +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main006.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type size_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main007.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main007.f90 +new file mode 100644 +index 0000000..4a80499 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main007.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main008.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main008.f90 +new file mode 100644 +index 0000000..d85e1bb +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main008.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int16_t ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(2) :: b ++ integer(2), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main009.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main009.f90 +new file mode 100644 +index 0000000..a613e46 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main009.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(4) :: b ++ integer(4), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main010.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main010.f90 +new file mode 100644 +index 0000000..c300630 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main010.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main011.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main011.f90 +new file mode 100644 +index 0000000..c5b3ec4 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main011.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_least8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main012.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main012.f90 +new file mode 100644 +index 0000000..50d736a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main012.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_least16_t ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(2) :: b ++ integer(2), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main013.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main013.f90 +new file mode 100644 +index 0000000..f1ed742 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main013.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_least32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(4) :: b ++ integer(4), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main014.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main014.f90 +new file mode 100644 +index 0000000..2cb4795 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main014.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_least8_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main015.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main015.f90 +new file mode 100644 +index 0000000..626f02a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main015.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_fast8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(1) :: b ++ integer(1), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main016.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main016.f90 +new file mode 100644 +index 0000000..2a41aa9 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main016.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_fast16_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main017.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main017.f90 +new file mode 100644 +index 0000000..1f4ae6a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main017.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_fast32_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main018.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main018.f90 +new file mode 100644 +index 0000000..9c99b13 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main018.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type int_fast64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main019.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main019.f90 +new file mode 100644 +index 0000000..4bdcd0c +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main019.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type intmax_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main020.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main020.f90 +new file mode 100644 +index 0000000..80b302e +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main020.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type intptr_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) result(res) ++ integer(8) :: b ++ integer(8), pointer :: res ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main021.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main021.f90 +new file mode 100644 +index 0000000..3760036 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main021.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type float ++! ++program main ++ real(4) :: my_x = 1.0 ++ interface ++ function c_func(b) result(res) ++ real(4) :: b ++ real(4), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main022.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main022.f90 +new file mode 100644 +index 0000000..491887f +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main022.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type double ++! ++program main ++ real(8) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) result(res) ++ real(8) :: b ++ real(8), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main023.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main023.f90 +new file mode 100644 +index 0000000..a8861c9 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the return type is ptr of type long double ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) result(res) ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: b ++ real(K), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main024.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main024.f90 +new file mode 100644 +index 0000000..2a49f2a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main024.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type float _Complex ++! ++program main ++ complex(4) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) result(res) ++ complex(4) :: b ++ complex(4), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main025.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main025.f90 +new file mode 100644 +index 0000000..e329c2a +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main025.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is ptr of type double ++! _Complex ++! ++program main ++ complex(8) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) result(res) ++ complex(8) :: b ++ complex(8), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main026.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main026.f90 +new file mode 100644 +index 0000000..6b2b0a2 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main026.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the return type is ptr of type long double ++! _Complex ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) result(res) ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: b ++ complex(K), pointer :: res ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main027.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main027.f90 +new file mode 100644 +index 0000000..28efc8d +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main027.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type _Bool ++! ++program main ++ logical(1) :: my_x = .FALSE. ++ interface ++ function c_func(b) result(res) ++ logical(1) :: b ++ logical(1), pointer :: res ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main028.f90 b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main028.f90 +new file mode 100644 +index 0000000..37a0198 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/fortran_main028.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is ptr of type char ++! ++program main ++ character(1) :: my_x = 'a' ++ interface ++ function c_func(b) result(res) ++ character(1) :: b ++ character(1), pointer :: res ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/011_fortran_call_c_function_ptr/run.sh b/test/interoperability_with_c/011_fortran_call_c_function_ptr/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/011_fortran_call_c_function_ptr/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func001.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func001.c +new file mode 100644 +index 0000000..5eabe70 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func001.c +@@ -0,0 +1,5 @@ ++#include ++int c_func_(int *a) { ++ printf("%5d\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func002.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func002.c +new file mode 100644 +index 0000000..87a9609 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++short c_func_(short *a) { ++ printf("%5hd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func003.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func003.c +new file mode 100644 +index 0000000..5ba1d95 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++long c_func_(long *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func004.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func004.c +new file mode 100644 +index 0000000..f3914cb +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++long long c_func_(long long *a) { ++ printf("%lld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func005.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func005.c +new file mode 100644 +index 0000000..1ea4f3e +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func005.c +@@ -0,0 +1,5 @@ ++#include ++signed char c_func_(signed char *a) { ++ printf("%5c\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func006.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func006.c +new file mode 100644 +index 0000000..f5a2dcc +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func006.c +@@ -0,0 +1,6 @@ ++#include ++#include ++size_t c_func_(size_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func007.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func007.c +new file mode 100644 +index 0000000..231e071 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func007.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int8_t c_func_(int8_t *a) { ++ printf("%5hhd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func008.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func008.c +new file mode 100644 +index 0000000..c243d9c +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func008.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int16_t c_func_(int16_t *a) { ++ printf("%5hd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func009.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func009.c +new file mode 100644 +index 0000000..ff5050c +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func009.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int32_t c_func_(int32_t *a) { ++ printf("%5d\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func010.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func010.c +new file mode 100644 +index 0000000..2249b6a +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func010.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int64_t c_func_(int64_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func011.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func011.c +new file mode 100644 +index 0000000..0eb9353 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func011.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least8_t c_func_(int_least8_t *a) { ++ printf("%5hhd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func012.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func012.c +new file mode 100644 +index 0000000..3a591b2 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func012.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least16_t c_func_(int_least16_t *a) { ++ printf("%5hd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func013.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func013.c +new file mode 100644 +index 0000000..cfbacdb +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func013.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least32_t c_func_(int_least32_t *a) { ++ printf("%d\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func014.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func014.c +new file mode 100644 +index 0000000..c922aa7 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func014.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least64_t c_func_(int_least64_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func015.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func015.c +new file mode 100644 +index 0000000..75b0963 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func015.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast8_t c_func_(int_fast8_t *a) { ++ printf("%5hhd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func016.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func016.c +new file mode 100644 +index 0000000..db5dce0 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func016.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast16_t c_func_(int_fast16_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func017.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func017.c +new file mode 100644 +index 0000000..fe66b2b +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func017.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast32_t c_func_(int_fast32_t *a) { ++ printf("%ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func018.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func018.c +new file mode 100644 +index 0000000..218f4bc +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func018.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast64_t c_func_(int_fast64_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func019.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func019.c +new file mode 100644 +index 0000000..60ef3e3 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func019.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intmax_t c_func_(intmax_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func020.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func020.c +new file mode 100644 +index 0000000..c1422b1 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func020.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intptr_t c_func_(intptr_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func021.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func021.c +new file mode 100644 +index 0000000..d922b72 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func021.c +@@ -0,0 +1,5 @@ ++#include ++float c_func_(float *a) { ++ printf("%0.20f\n", *a); ++ return *a + 0.5; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func022.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func022.c +new file mode 100644 +index 0000000..d86716c +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func022.c +@@ -0,0 +1,5 @@ ++#include ++double c_func_(double *a) { ++ printf("%0.20lf\n", *a); ++ return *a + 0.5; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func023.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func023.c +new file mode 100644 +index 0000000..67b260e +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func023.c +@@ -0,0 +1,5 @@ ++#include ++long double c_func_(long double *a) { ++ printf("%0.20Lf\n", *a); ++ return *a + 0.5; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func024.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func024.c +new file mode 100644 +index 0000000..87b3e4c +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func024.c +@@ -0,0 +1,6 @@ ++#include ++#include ++float _Complex c_func_(float _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return *t; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func025.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func025.c +new file mode 100644 +index 0000000..2d7b33f +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func025.c +@@ -0,0 +1,6 @@ ++#include ++#include ++double _Complex c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(*t), cimag(*t)); ++ return *t; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func026.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func026.c +new file mode 100644 +index 0000000..78f93c9 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func026.c +@@ -0,0 +1,6 @@ ++#include ++#include ++long double _Complex c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return *t; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func027.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func027.c +new file mode 100644 +index 0000000..2bf5cce +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func027.c +@@ -0,0 +1,5 @@ ++#include ++_Bool c_func_(_Bool *a) { ++ printf("%5d\n", *a); ++ return *a; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func028.c b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func028.c +new file mode 100644 +index 0000000..0cf496b +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/c_func028.c +@@ -0,0 +1,6 @@ ++#include ++#include ++char c_func_(char *t) { ++ printf("%s\n", t); ++ return *t; ++} +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main001.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main001.f90 +new file mode 100644 +index 0000000..e5c3136 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main001.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type int with ++! bindc ++! ++program main ++ integer :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer :: b ++ integer :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main002.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main002.f90 +new file mode 100644 +index 0000000..2ee063d +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main002.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type short with ++! bindc ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(2) :: b ++ integer(2) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main003.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main003.f90 +new file mode 100644 +index 0000000..188fee6 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main003.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type long with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main004.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main004.f90 +new file mode 100644 +index 0000000..4853b2c +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main004.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type long long ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main005.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main005.f90 +new file mode 100644 +index 0000000..102b537 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main005.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type signed char ++! with bindc ++! ++program main ++ integer(1) :: my_x = 65 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main006.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main006.f90 +new file mode 100644 +index 0000000..3baa816 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main006.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type size_t with ++! bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main007.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main007.f90 +new file mode 100644 +index 0000000..077dc37 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main007.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type int8_t with ++! bindc ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main008.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main008.f90 +new file mode 100644 +index 0000000..20b0b65 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main008.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type int16_t ++! with bindc ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(2) :: b ++ integer(2) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main009.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main009.f90 +new file mode 100644 +index 0000000..29a0690 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main009.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type int32_t ++! with bindc ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(4) :: b ++ integer(4) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main010.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main010.f90 +new file mode 100644 +index 0000000..7a96c7d +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main010.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type int64_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main011.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main011.f90 +new file mode 100644 +index 0000000..7cf5dbe +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main011.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least8_t with bindc ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main012.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main012.f90 +new file mode 100644 +index 0000000..e30fa5b +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main012.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least16_t with bindc ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(2) :: b ++ integer(2) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main013.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main013.f90 +new file mode 100644 +index 0000000..0da6955 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main013.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least32_t with bindc ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(4) :: b ++ integer(4) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main014.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main014.f90 +new file mode 100644 +index 0000000..f8b072f +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main014.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least8_t with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main015.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main015.f90 +new file mode 100644 +index 0000000..87036fe +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main015.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type int_fast8_t ++! with bindc ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main016.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main016.f90 +new file mode 100644 +index 0000000..37e5808 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main016.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_fast16_t with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main017.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main017.f90 +new file mode 100644 +index 0000000..74208cd +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main017.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_fast32_t with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main018.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main018.f90 +new file mode 100644 +index 0000000..b9443d6 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main018.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_fast64_t with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main019.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main019.f90 +new file mode 100644 +index 0000000..0b99dc4 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main019.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type intmax_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main020.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main020.f90 +new file mode 100644 +index 0000000..a9af5b9 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main020.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type intptr_t ++! with bindc ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main021.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main021.f90 +new file mode 100644 +index 0000000..0e946c9 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main021.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type float with ++! bindc ++! ++program main ++ real(4) :: my_x = 1.0 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ real(4) :: b ++ real(4) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main022.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main022.f90 +new file mode 100644 +index 0000000..72ab9f7 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main022.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type double with ++! bindc ++! ++program main ++ real(8) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ real(8) :: b ++ real(8) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main023.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main023.f90 +new file mode 100644 +index 0000000..d216a97 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main023.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the return type is scalar of type long double ++! with bindc ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: b ++ real(K) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main024.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main024.f90 +new file mode 100644 +index 0000000..cbf38c5 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main024.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type float ++! _Complex with bindc ++! ++program main ++ complex(4) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ complex(4) :: b ++ complex(4) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main025.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main025.f90 +new file mode 100644 +index 0000000..50a3c27 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main025.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type double ++! _Complex with bindc ++! ++program main ++ complex(8) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ complex(8) :: b ++ complex(8) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main026.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main026.f90 +new file mode 100644 +index 0000000..e0ba7c3 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main026.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the return type is scalar of type long double ++! _Complex with bindc ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: b ++ complex(K) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main027.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main027.f90 +new file mode 100644 +index 0000000..042cafc +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main027.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type _Bool with ++! bindc ++! ++program main ++ logical(1) :: my_x = .FALSE. ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ logical(1) :: b ++ logical(1) :: c_func ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main028.f90 b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main028.f90 +new file mode 100644 +index 0000000..c1bd3cd +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/fortran_main028.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type char with ++! bindc ++! ++program main ++ character(1) :: my_x = 'a' ++ interface ++ function c_func(b) bind(c, name = "c_func_") ++ character(1) :: b ++ character(1) :: c_func ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/run.sh b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/012_fortran_call_c_function_value_bindc/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func001.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func001.c +new file mode 100644 +index 0000000..5eabe70 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func001.c +@@ -0,0 +1,5 @@ ++#include ++int c_func_(int *a) { ++ printf("%5d\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func002.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func002.c +new file mode 100644 +index 0000000..87a9609 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func002.c +@@ -0,0 +1,5 @@ ++#include ++short c_func_(short *a) { ++ printf("%5hd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func003.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func003.c +new file mode 100644 +index 0000000..5ba1d95 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func003.c +@@ -0,0 +1,5 @@ ++#include ++long c_func_(long *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func004.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func004.c +new file mode 100644 +index 0000000..f3914cb +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func004.c +@@ -0,0 +1,5 @@ ++#include ++long long c_func_(long long *a) { ++ printf("%lld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func005.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func005.c +new file mode 100644 +index 0000000..1ea4f3e +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func005.c +@@ -0,0 +1,5 @@ ++#include ++signed char c_func_(signed char *a) { ++ printf("%5c\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func006.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func006.c +new file mode 100644 +index 0000000..f5a2dcc +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func006.c +@@ -0,0 +1,6 @@ ++#include ++#include ++size_t c_func_(size_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func007.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func007.c +new file mode 100644 +index 0000000..231e071 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func007.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int8_t c_func_(int8_t *a) { ++ printf("%5hhd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func008.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func008.c +new file mode 100644 +index 0000000..c243d9c +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func008.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int16_t c_func_(int16_t *a) { ++ printf("%5hd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func009.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func009.c +new file mode 100644 +index 0000000..ff5050c +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func009.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int32_t c_func_(int32_t *a) { ++ printf("%5d\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func010.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func010.c +new file mode 100644 +index 0000000..2249b6a +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func010.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int64_t c_func_(int64_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func011.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func011.c +new file mode 100644 +index 0000000..0eb9353 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func011.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least8_t c_func_(int_least8_t *a) { ++ printf("%5hhd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func012.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func012.c +new file mode 100644 +index 0000000..3a591b2 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func012.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least16_t c_func_(int_least16_t *a) { ++ printf("%5hd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func013.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func013.c +new file mode 100644 +index 0000000..cfbacdb +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func013.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least32_t c_func_(int_least32_t *a) { ++ printf("%d\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func014.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func014.c +new file mode 100644 +index 0000000..c922aa7 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func014.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_least64_t c_func_(int_least64_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func015.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func015.c +new file mode 100644 +index 0000000..75b0963 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func015.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast8_t c_func_(int_fast8_t *a) { ++ printf("%5hhd\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func016.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func016.c +new file mode 100644 +index 0000000..db5dce0 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func016.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast16_t c_func_(int_fast16_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func017.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func017.c +new file mode 100644 +index 0000000..fe66b2b +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func017.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast32_t c_func_(int_fast32_t *a) { ++ printf("%ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func018.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func018.c +new file mode 100644 +index 0000000..218f4bc +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func018.c +@@ -0,0 +1,6 @@ ++#include ++#include ++int_fast64_t c_func_(int_fast64_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func019.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func019.c +new file mode 100644 +index 0000000..60ef3e3 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func019.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intmax_t c_func_(intmax_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func020.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func020.c +new file mode 100644 +index 0000000..c1422b1 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func020.c +@@ -0,0 +1,6 @@ ++#include ++#include ++intptr_t c_func_(intptr_t *a) { ++ printf("%5ld\n", *a); ++ return *a + 1; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func021.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func021.c +new file mode 100644 +index 0000000..d922b72 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func021.c +@@ -0,0 +1,5 @@ ++#include ++float c_func_(float *a) { ++ printf("%0.20f\n", *a); ++ return *a + 0.5; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func022.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func022.c +new file mode 100644 +index 0000000..d86716c +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func022.c +@@ -0,0 +1,5 @@ ++#include ++double c_func_(double *a) { ++ printf("%0.20lf\n", *a); ++ return *a + 0.5; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func023.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func023.c +new file mode 100644 +index 0000000..67b260e +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func023.c +@@ -0,0 +1,5 @@ ++#include ++long double c_func_(long double *a) { ++ printf("%0.20Lf\n", *a); ++ return *a + 0.5; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func024.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func024.c +new file mode 100644 +index 0000000..87b3e4c +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func024.c +@@ -0,0 +1,6 @@ ++#include ++#include ++float _Complex c_func_(float _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return *t; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func025.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func025.c +new file mode 100644 +index 0000000..2d7b33f +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func025.c +@@ -0,0 +1,6 @@ ++#include ++#include ++double _Complex c_func_(double _Complex *t) { ++ printf("%0.20lf + %0.20lfi\n", creal(*t), cimag(*t)); ++ return *t; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func026.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func026.c +new file mode 100644 +index 0000000..78f93c9 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func026.c +@@ -0,0 +1,6 @@ ++#include ++#include ++long double _Complex c_func_(long double _Complex *t) { ++ printf("%0.20f + %0.20fi\n", creal(*t), cimag(*t)); ++ return *t; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func027.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func027.c +new file mode 100644 +index 0000000..2bf5cce +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func027.c +@@ -0,0 +1,5 @@ ++#include ++_Bool c_func_(_Bool *a) { ++ printf("%5d\n", *a); ++ return *a; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/c_func028.c b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func028.c +new file mode 100644 +index 0000000..0cf496b +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/c_func028.c +@@ -0,0 +1,6 @@ ++#include ++#include ++char c_func_(char *t) { ++ printf("%s\n", t); ++ return *t; ++} +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main001.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main001.f90 +new file mode 100644 +index 0000000..229ca82 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main001.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type int ++! ++program main ++ integer :: my_x = 1 ++ interface ++ function c_func(b) ++ integer :: b ++ integer :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main002.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main002.f90 +new file mode 100644 +index 0000000..d31e0f8 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main002.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type short ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(2) :: b ++ integer(2) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main003.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main003.f90 +new file mode 100644 +index 0000000..638ea88 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main003.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type long ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main004.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main004.f90 +new file mode 100644 +index 0000000..c905670 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main004.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type long long ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main005.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main005.f90 +new file mode 100644 +index 0000000..be8aaf8 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main005.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type signed char ++! ++program main ++ integer(1) :: my_x = 65 ++ interface ++ function c_func(b) ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main006.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main006.f90 +new file mode 100644 +index 0000000..b9afa1a +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main006.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type size_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main007.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main007.f90 +new file mode 100644 +index 0000000..b8548c3 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main007.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type int8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main008.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main008.f90 +new file mode 100644 +index 0000000..89f3809 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main008.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type int16_t ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(2) :: b ++ integer(2) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main009.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main009.f90 +new file mode 100644 +index 0000000..8162ab0 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main009.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type int32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(4) :: b ++ integer(4) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main010.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main010.f90 +new file mode 100644 +index 0000000..83616f8 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main010.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type int64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main011.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main011.f90 +new file mode 100644 +index 0000000..6fb5a66 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main011.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main012.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main012.f90 +new file mode 100644 +index 0000000..ef04a7a +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main012.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least16_t ++! ++program main ++ integer(2) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(2) :: b ++ integer(2) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main013.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main013.f90 +new file mode 100644 +index 0000000..f4f8893 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main013.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least32_t ++! ++program main ++ integer(4) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(4) :: b ++ integer(4) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main014.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main014.f90 +new file mode 100644 +index 0000000..faa3acf +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main014.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_least8_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main015.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main015.f90 +new file mode 100644 +index 0000000..03f3b8f +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main015.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type int_fast8_t ++! ++program main ++ integer(1) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(1) :: b ++ integer(1) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main016.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main016.f90 +new file mode 100644 +index 0000000..4c80fe3 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main016.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_fast16_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main017.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main017.f90 +new file mode 100644 +index 0000000..95caef9 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main017.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_fast32_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main018.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main018.f90 +new file mode 100644 +index 0000000..acd5b25 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main018.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! int_fast64_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main019.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main019.f90 +new file mode 100644 +index 0000000..e4ee87f +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main019.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type intmax_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main020.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main020.f90 +new file mode 100644 +index 0000000..b93dec1 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main020.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type intptr_t ++! ++program main ++ integer(8) :: my_x = 1 ++ interface ++ function c_func(b) ++ integer(8) :: b ++ integer(8) :: c_func ++ end ++ end interface ++ print '(I5)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main021.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main021.f90 +new file mode 100644 +index 0000000..689a134 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main021.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type float ++! ++program main ++ real(4) :: my_x = 1.0 ++ interface ++ function c_func(b) ++ real(4) :: b ++ real(4) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main022.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main022.f90 +new file mode 100644 +index 0000000..05582ae +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main022.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type double ++! ++program main ++ real(8) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) ++ real(8) :: b ++ real(8) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main023.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main023.f90 +new file mode 100644 +index 0000000..388a97a +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main023.f90 +@@ -0,0 +1,14 @@ ++! Test fortran call c for the return type is scalar of type long double ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: my_x = 3.1415926535 ++ interface ++ function c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ real(K) :: b ++ real(K) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main024.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main024.f90 +new file mode 100644 +index 0000000..d107e95 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main024.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! float _Complex ++! ++program main ++ complex(4) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) ++ complex(4) :: b ++ complex(4) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main025.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main025.f90 +new file mode 100644 +index 0000000..d08ea5f +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main025.f90 +@@ -0,0 +1,13 @@ ++! Test fortran call c for the return type is scalar of type ++! double _Complex ++! ++program main ++ complex(8) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) ++ complex(8) :: b ++ complex(8) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main026.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main026.f90 +new file mode 100644 +index 0000000..e0134df +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main026.f90 +@@ -0,0 +1,15 @@ ++! Test fortran call c for the return type is scalar of type ++! long double _Complex ++! ++program main ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: my_x = (3.1415926535, 1) ++ interface ++ function c_func(b) ++ integer, parameter :: K = selected_real_kind(16) ++ complex(K) :: b ++ complex(K) :: c_func ++ end ++ end interface ++ print '(F20.10)', c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main027.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main027.f90 +new file mode 100644 +index 0000000..aef8c72 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main027.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type _Bool ++! ++program main ++ logical(1) :: my_x = .FALSE. ++ interface ++ function c_func(b) ++ logical(1) :: b ++ logical(1) :: c_func ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main028.f90 b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main028.f90 +new file mode 100644 +index 0000000..5290620 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/fortran_main028.f90 +@@ -0,0 +1,12 @@ ++! Test fortran call c for the return type is scalar of type char ++! ++program main ++ character(1) :: my_x = 'a' ++ interface ++ function c_func(b) ++ character(1) :: b ++ character(1) :: c_func ++ end ++ end interface ++ print *, c_func(my_x) ++end +diff --git a/test/interoperability_with_c/013_fortran_call_c_function_value/run.sh b/test/interoperability_with_c/013_fortran_call_c_function_value/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/013_fortran_call_c_function_value/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func001.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func001.c +new file mode 100755 +index 0000000..0da9335 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func001.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ int j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int x, y; ++}; ++void c_func_(struct Ty *t, int *a) { ++ printf("%d\t", t->bt.j[0]); ++ printf("%d\t", t->bt.j[1]); ++ printf("%d\t", t->x); ++ printf("%d\t", t->y); ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func002.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func002.c +new file mode 100755 +index 0000000..d43d87c +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func002.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ short j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ short x, y; ++}; ++void c_func_(struct Ty *t, short *a) { ++ printf("%hd\t", t->bt.j[0]); ++ printf("%hd\t", t->bt.j[1]); ++ printf("%hd\t", t->x); ++ printf("%hd\t", t->y); ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func003.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func003.c +new file mode 100755 +index 0000000..7901c06 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func003.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ long j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ long x, y; ++}; ++void c_func_(struct Ty *t, long *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func004.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func004.c +new file mode 100755 +index 0000000..061fcfa +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func004.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ long long int j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ long long int x, y; ++}; ++void c_func_(struct Ty *t, long long int *a) { ++ printf("%lld\t", t->bt.j[0]); ++ printf("%lld\t", t->bt.j[1]); ++ printf("%lld\t", t->x); ++ printf("%lld\t", t->y); ++ printf("%lld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func005.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func005.c +new file mode 100755 +index 0000000..ca651e3 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func005.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ signed char j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ signed char x, y; ++}; ++void c_func_(struct Ty *t, signed char *a) { ++ printf("%c\t", t->bt.j[0]); ++ printf("%c\t", t->bt.j[1]); ++ printf("%c\t", t->x); ++ printf("%c\t", t->y); ++ printf("%c\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func006.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func006.c +new file mode 100755 +index 0000000..56c7f41 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func006.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ size_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ size_t x, y; ++}; ++void c_func_(struct Ty *t, size_t *a) { ++ printf("%lu\t", t->bt.j[0]); ++ printf("%lu\t", t->bt.j[1]); ++ printf("%lu\t", t->x); ++ printf("%lu\t", t->y); ++ printf("%lu\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func007.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func007.c +new file mode 100755 +index 0000000..2a8eaa8 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func007.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int8_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int8_t x, y; ++}; ++void c_func_(struct Ty *t, int8_t *a) { ++ printf("%hhd\t", t->bt.j[0]); ++ printf("%hhd\t", t->bt.j[1]); ++ printf("%hhd\t", t->x); ++ printf("%hhd\t", t->y); ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func008.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func008.c +new file mode 100755 +index 0000000..f45f58e +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func008.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int16_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int16_t x, y; ++}; ++void c_func_(struct Ty *t, int16_t *a) { ++ printf("%hd\t", t->bt.j[0]); ++ printf("%hd\t", t->bt.j[1]); ++ printf("%hd\t", t->x); ++ printf("%hd\t", t->y); ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func009.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func009.c +new file mode 100755 +index 0000000..01ad489 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func009.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int32_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int32_t x, y; ++}; ++void c_func_(struct Ty *t, int32_t *a) { ++ printf("%d\t", t->bt.j[0]); ++ printf("%d\t", t->bt.j[1]); ++ printf("%d\t", t->x); ++ printf("%d\t", t->y); ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func010.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func010.c +new file mode 100755 +index 0000000..105ad9a +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func010.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int64_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int64_t x, y; ++}; ++void c_func_(struct Ty *t, int64_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func011.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func011.c +new file mode 100755 +index 0000000..e19a9f0 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func011.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_least8_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_least8_t x, y; ++}; ++void c_func_(struct Ty *t, int_least8_t *a) { ++ printf("%hhd\t", t->bt.j[0]); ++ printf("%hhd\t", t->bt.j[1]); ++ printf("%hhd\t", t->x); ++ printf("%hhd\t", t->y); ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func012.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func012.c +new file mode 100755 +index 0000000..1b9064b +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func012.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_least16_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_least16_t x, y; ++}; ++void c_func_(struct Ty *t, int_least16_t *a) { ++ printf("%hd\t", t->bt.j[0]); ++ printf("%hd\t", t->bt.j[1]); ++ printf("%hd\t", t->x); ++ printf("%hd\t", t->y); ++ printf("%hd\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func013.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func013.c +new file mode 100755 +index 0000000..9ab4390 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func013.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_least32_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_least32_t x, y; ++}; ++void c_func_(struct Ty *t, int_least32_t *a) { ++ printf("%d\t", t->bt.j[0]); ++ printf("%d\t", t->bt.j[1]); ++ printf("%d\t", t->x); ++ printf("%d\t", t->y); ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func014.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func014.c +new file mode 100755 +index 0000000..82bd2a2 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func014.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_least64_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_least64_t x, y; ++}; ++void c_func_(struct Ty *t, int_least64_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func015.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func015.c +new file mode 100755 +index 0000000..b2a9da9 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func015.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_fast8_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_fast8_t x, y; ++}; ++void c_func_(struct Ty *t, int_fast8_t *a) { ++ printf("%hhd\t", t->bt.j[0]); ++ printf("%hhd\t", t->bt.j[1]); ++ printf("%hhd\t", t->x); ++ printf("%hhd\t", t->y); ++ printf("%hhd\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func016.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func016.c +new file mode 100755 +index 0000000..f35b45c +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func016.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_fast16_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_fast16_t x, y; ++}; ++void c_func_(struct Ty *t, int_fast16_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func017.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func017.c +new file mode 100755 +index 0000000..4d6e335 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func017.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_fast32_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_fast32_t x, y; ++}; ++void c_func_(struct Ty *t, int_fast32_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func018.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func018.c +new file mode 100755 +index 0000000..86d6afa +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func018.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_fast64_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_fast64_t x, y; ++}; ++void c_func_(struct Ty *t, int_fast64_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func019.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func019.c +new file mode 100755 +index 0000000..48600a8 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func019.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ intmax_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ intmax_t x, y; ++}; ++void c_func_(struct Ty *t, intmax_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func020.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func020.c +new file mode 100755 +index 0000000..88cb6d9 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func020.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ intptr_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ intptr_t x, y; ++}; ++void c_func_(struct Ty *t, intptr_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func021.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func021.c +new file mode 100755 +index 0000000..4ef4c87 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func021.c +@@ -0,0 +1,15 @@ ++#include ++#include ++struct BaseTy { ++ float j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ float x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.2f\t", t->bt.j[0]); ++ printf("%.2f\t", t->bt.j[1]); ++ printf("%.2f\t", t->x); ++ printf("%.2f\n", t->y); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func022.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func022.c +new file mode 100755 +index 0000000..6a17869 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func022.c +@@ -0,0 +1,15 @@ ++#include ++#include ++struct BaseTy { ++ double j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ double x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.6lf\t", t->bt.j[0]); ++ printf("%.6lf\t", t->bt.j[1]); ++ printf("%.6lf\t", t->x); ++ printf("%.6lf\n", t->y); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func023.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func023.c +new file mode 100755 +index 0000000..ce676c0 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func023.c +@@ -0,0 +1,15 @@ ++#include ++#include ++struct BaseTy { ++ long double j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ long double x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%.6Lf\t", t->bt.j[0]); ++ printf("%.6Lf\t", t->bt.j[1]); ++ printf("%.6Lf\t", t->x); ++ printf("%.6Lf\n", t->y); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func024.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func024.c +new file mode 100755 +index 0000000..65f9cd3 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func024.c +@@ -0,0 +1,15 @@ ++#include ++#include ++struct BaseTy { ++ float _Complex j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ float _Complex x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->bt.j[0]), cimag(t->bt.j[0])); ++ printf("%f + %fi\n", creal(t->bt.j[1]), cimag(t->bt.j[1])); ++ printf("%f + %fi\n", creal(t->x), cimag(t->x)); ++ printf("%f + %fi\n", creal(t->y), cimag(t->y)); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func025.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func025.c +new file mode 100755 +index 0000000..5a508d3 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func025.c +@@ -0,0 +1,15 @@ ++#include ++#include ++struct BaseTy { ++ double _Complex j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ double _Complex x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%lf + %lfi\n", creal(t->bt.j[0]), cimag(t->bt.j[0])); ++ printf("%lf + %lfi\n", creal(t->bt.j[1]), cimag(t->bt.j[1])); ++ printf("%lf + %lfi\n", creal(t->x), cimag(t->x)); ++ printf("%lf + %lfi\n", creal(t->y), cimag(t->y)); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func026.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func026.c +new file mode 100755 +index 0000000..3969809 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func026.c +@@ -0,0 +1,15 @@ ++#include ++#include ++struct BaseTy { ++ long double _Complex j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ long double _Complex x, y; ++}; ++void c_func_(struct Ty *t) { ++ printf("%f + %fi\n", creal(t->bt.j[0]), cimag(t->bt.j[0])); ++ printf("%f + %fi\n", creal(t->bt.j[1]), cimag(t->bt.j[1])); ++ printf("%f + %fi\n", creal(t->x), cimag(t->x)); ++ printf("%f + %fi\n", creal(t->y), cimag(t->y)); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func027.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func027.c +new file mode 100755 +index 0000000..8847072 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func027.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ _Bool j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ _Bool x, y; ++}; ++void c_func_(struct Ty *t, _Bool *a) { ++ printf("%d\t", t->bt.j[0]); ++ printf("%d\t", t->bt.j[1]); ++ printf("%d\t", t->x); ++ printf("%d\t", t->y); ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/c_func028.c b/test/interoperability_with_c/014_fortran_call_c_mix/c_func028.c +new file mode 100755 +index 0000000..988b739 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/c_func028.c +@@ -0,0 +1,15 @@ ++#include ++struct BaseTy { ++ char j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ char x, y; ++}; ++void c_func_(struct Ty *t, int *a) { ++ printf("%c\t", t->bt.j[0]); ++ printf("%c\t", t->bt.j[1]); ++ printf("%c\t", t->x); ++ printf("%c\t", t->y); ++ printf("%c\n", *a); ++} +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main001.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main001.f90 +new file mode 100755 +index 0000000..37bfd33 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main001.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT) :: x = -2147483647 ++ integer(4) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INT) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main002.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main002.f90 +new file mode 100755 +index 0000000..ad07ec8 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main002.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type short ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_SHORT) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_SHORT) :: x = -32768 ++ integer(2) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ integer(C_SHORT) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_SHORT) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main003.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main003.f90 +new file mode 100755 +index 0000000..4b182aa +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main003.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type long ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_LONG) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_LONG) :: x = -2147483647 ++ integer(8) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_LONG) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_LONG) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main004.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main004.f90 +new file mode 100755 +index 0000000..7a1d67a +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main004.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type long long ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_LONG_LONG) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_LONG_LONG) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ integer(C_LONG_LONG) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_LONG_LONG) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main005.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main005.f90 +new file mode 100755 +index 0000000..5fa4d83 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main005.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type signed char ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_SIGNED_CHAR) :: j(2) = 65 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_SIGNED_CHAR) :: x = 66 ++ integer(1) :: y = 67 ++ end type t ++ type(t) :: my_t ++ integer(C_SIGNED_CHAR) :: my_x = 68 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_SIGNED_CHAR) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main006.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main006.f90 +new file mode 100755 +index 0000000..1ef89d9 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main006.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type size_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_SIZE_T) :: j(2) = 2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_SIZE_T) :: x = 9223372036854775807 ++ integer(8) :: y = 0 ++ end type t ++ type(t) :: my_t ++ integer(C_SIZE_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_SIZE_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main007.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main007.f90 +new file mode 100755 +index 0000000..56e5341 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main007.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int8_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT8_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT8_T) :: x = -128 ++ integer(1) :: y = 127 ++ end type t ++ type(t) :: my_t ++ integer(C_INT8_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT8_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main008.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main008.f90 +new file mode 100755 +index 0000000..8b5a4ce +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main008.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int16_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT16_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT16_T) :: x = -32768 ++ integer(2) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ integer(C_INT16_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT16_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main009.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main009.f90 +new file mode 100755 +index 0000000..2674ede +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main009.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int32_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT32_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT32_T) :: x = -2147483647 ++ integer(4) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INT32_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT32_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main010.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main010.f90 +new file mode 100755 +index 0000000..9d50708 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main010.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int64_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT64_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT64_T) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ integer(C_INT64_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT64_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main011.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main011.f90 +new file mode 100755 +index 0000000..3e895fc +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main011.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_least8_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_LEAST8_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_LEAST8_T) :: x = -128 ++ integer(1) :: y = 127 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_LEAST8_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_LEAST8_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main012.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main012.f90 +new file mode 100755 +index 0000000..a8b0ef5 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main012.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_least16_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_LEAST16_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_LEAST16_T) :: x = -32768 ++ integer(2) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_LEAST16_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_LEAST16_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main013.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main013.f90 +new file mode 100755 +index 0000000..62e8b11 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main013.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_least32_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_LEAST32_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_LEAST32_T) :: x = -2147483647 ++ integer(4) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_LEAST32_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_LEAST32_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main014.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main014.f90 +new file mode 100755 +index 0000000..1b0aa8e +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main014.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call ! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_least64_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_LEAST64_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_LEAST64_T) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_LEAST64_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_LEAST64_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main015.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main015.f90 +new file mode 100755 +index 0000000..52d7e1d +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main015.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_fast8_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_FAST8_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_FAST8_T) :: x = -128 ++ integer(1) :: y = 127 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_FAST8_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_FAST8_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main016.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main016.f90 +new file mode 100755 +index 0000000..05bd335 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main016.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_fast16_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_FAST16_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_FAST16_T) :: x = -32768 ++ integer(8) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_FAST16_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_FAST16_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main017.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main017.f90 +new file mode 100755 +index 0000000..0a648b4 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main017.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_fast32_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_FAST32_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_FAST32_T) :: x = -2147483647 ++ integer(8) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_FAST32_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_FAST32_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main018.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main018.f90 +new file mode 100755 +index 0000000..34fd6b2 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main018.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_fast64_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_FAST64_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_FAST64_T) :: x = -9223372036854775807 ++ integer(8) :: y = 9223372036854775807 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_FAST64_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_FAST64_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main019.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main019.f90 +new file mode 100755 +index 0000000..d18bfaa +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main019.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type int_intmax_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INTMAX_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INTMAX_T) :: x = 11548694 ++ integer(8) :: y = 916519685 ++ end type t ++ type(t) :: my_t ++ integer(C_INTMAX_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INTMAX_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main020.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main020.f90 +new file mode 100755 +index 0000000..849525a +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main020.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type intptr_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INTPTR_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INTPTR_T) :: x = -922337 ++ integer(8) :: y = 922337 ++ end type t ++ type(t) :: my_t ++ integer(C_INTPTR_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INTPTR_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main021.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main021.f90 +new file mode 100755 +index 0000000..ecb0e02 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main021.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type float ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ real(C_FLOAT) :: j(2) = -2.36 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ real(C_FLOAT) :: x = -3.14 ++ real(4) :: y = 3.14 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main022.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main022.f90 +new file mode 100755 +index 0000000..7865856 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main022.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type double ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ real(C_DOUBLE) :: j(2) = 450359962737049.621345 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ real(C_DOUBLE) :: x = -450359962737049.621113 ++ real(8) :: y = 12345678.7654321 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main023.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main023.f90 +new file mode 100755 +index 0000000..d88c887 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main023.f90 +@@ -0,0 +1,25 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type long double ++! ++program main ++ use iso_c_binding ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: base ++ real(C_LONG_DOUBLE) :: j(2) = 50359534651234685432213246841962737049.621345 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ real(C_LONG_DOUBLE) :: x = -450359962737049.621113 ++ real(K) :: y = 12345678.7654321 ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main024.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main024.f90 +new file mode 100755 +index 0000000..033c05a +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main024.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type float complex ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ complex(C_FLOAT_COMPLEX) :: j(2) = (1, 2); ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ complex(C_FLOAT_COMPLEX) :: x = (-3, 1) ++ complex(4) :: y = (3, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main025.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main025.f90 +new file mode 100755 +index 0000000..e03cd28 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main025.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type double complex ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ complex(C_DOUBLE_COMPLEX) :: j(2) = (4503599.6, 621.345); ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ complex(C_DOUBLE_COMPLEX) :: x = (-3.14159265358979, 1) ++ complex(8) :: y = (3.14159265358979, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main026.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main026.f90 +new file mode 100755 +index 0000000..a3af173 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main026.f90 +@@ -0,0 +1,25 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type long double complex ++! ++program main ++ use iso_c_binding ++ integer, parameter :: K = selected_real_kind(16) ++ type, bind(c) :: base ++ complex(C_LONG_DOUBLE_COMPLEX) :: j(2) = (45545204745299.6, 621.345); ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ complex(C_LONG_DOUBLE_COMPLEX) :: x = (-3.14159265358979, 1) ++ complex(K) :: y = (3.14159265358979, 1) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main027.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main027.f90 +new file mode 100755 +index 0000000..2df1f57 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main027.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type bool ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ logical(C_BOOL) :: j(2) = .TRUE. ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ logical(C_BOOL) :: x = .FALSE. ++ logical(1) :: y = .TRUE. ++ end type t ++ type(t) :: my_t ++ logical(C_BOOL) :: my_x = .FALSE. ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ logical(C_BOOL) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main028.f90 b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main028.f90 +new file mode 100755 +index 0000000..23450cd +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/fortran_main028.f90 +@@ -0,0 +1,26 @@ ++! Test fortran call c for the derived type and the derived type has ++! multiple components and one component is the derived type. remaining ++! components are mixed type char ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ character(C_CHAR) :: j(2) = 'a' ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ character(C_CHAR) :: x = 'b' ++ character(1) :: y = 'c' ++ end type t ++ type(t) :: my_t ++ character(C_CHAR) :: my_x = 'd' ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ character(C_CHAR) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/014_fortran_call_c_mix/run.sh b/test/interoperability_with_c/014_fortran_call_c_mix/run.sh +new file mode 100644 +index 0000000..632b582 +--- /dev/null ++++ b/test/interoperability_with_c/014_fortran_call_c_mix/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..028} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/c_func001.c b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func001.c +new file mode 100644 +index 0000000..87c1454 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func001.c +@@ -0,0 +1,4 @@ ++#include ++void c_func_(int *a) { ++ printf("ok\n"); ++} +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/c_func002.c b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func002.c +new file mode 100644 +index 0000000..061affd +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func002.c +@@ -0,0 +1,7 @@ ++#include ++struct Ty { ++ int x[0]; ++}; ++void c_func_(struct Ty *t) { ++ printf("ok\n"); ++} +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/c_func003.c b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func003.c +new file mode 100644 +index 0000000..ed175d9 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func003.c +@@ -0,0 +1,12 @@ ++#include ++struct BaseTy { ++}; ++struct Ty { ++ struct BaseTy bt; ++ int x, y; ++}; ++void c_func_(struct Ty *t, int *a) { ++ printf("%d\t", t->x); ++ printf("%d\t", t->y); ++ printf("%d\n", *a); ++} +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/c_func004.c b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func004.c +new file mode 100644 +index 0000000..f35b45c +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func004.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_fast16_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_fast16_t x, y; ++}; ++void c_func_(struct Ty *t, int_fast16_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/c_func005.c b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func005.c +new file mode 100644 +index 0000000..4d6e335 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func005.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ int_fast32_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ int_fast32_t x, y; ++}; ++void c_func_(struct Ty *t, int_fast32_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/c_func006.c b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func006.c +new file mode 100644 +index 0000000..48600a8 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/c_func006.c +@@ -0,0 +1,16 @@ ++#include ++#include ++struct BaseTy { ++ intmax_t j[2]; ++}; ++struct Ty { ++ struct BaseTy bt; ++ intmax_t x, y; ++}; ++void c_func_(struct Ty *t, intmax_t *a) { ++ printf("%ld\t", t->bt.j[0]); ++ printf("%ld\t", t->bt.j[1]); ++ printf("%ld\t", t->x); ++ printf("%ld\t", t->y); ++ printf("%ld\n", *a); ++} +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main001.f90 b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main001.f90 +new file mode 100644 +index 0000000..8247452 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main001.f90 +@@ -0,0 +1,11 @@ ++! Test fortran call c for an array of integer and the array is null ++! ++program main ++ integer :: my_x(0) ++ interface ++ subroutine c_func(b) ++ integer :: b(0) ++ end ++ end interface ++ call c_func(my_x) ++end +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main002.f90 b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main002.f90 +new file mode 100644 +index 0000000..f32f396 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main002.f90 +@@ -0,0 +1,16 @@ ++! Test fortran call c for the derived type and one component of the ++! derived type is a null array ++! ++program main ++ type, bind(c) :: t ++ integer :: x(0) ++ end type t ++ type(t) :: my_t ++ interface ++ subroutine c_func(a) ++ import :: t ++ type(t) :: a ++ end ++ end interface ++ call c_func(my_t) ++end +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main003.f90 b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main003.f90 +new file mode 100644 +index 0000000..7130845 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main003.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for the derived type and one component of the ++! derived type is a null derived type ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT) :: x = -2147483647 ++ integer(C_INT) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INT) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main004.f90 b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main004.f90 +new file mode 100644 +index 0000000..2d50b2b +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main004.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for composite scenario of type int_fast16_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_FAST16_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_FAST16_T) :: x = -32768 ++ integer(C_INT_FAST16_T) :: y = 32767 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_FAST16_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_FAST16_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main005.f90 b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main005.f90 +new file mode 100644 +index 0000000..c084956 +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main005.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for composite scenario of type int_fast32_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INT_FAST32_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INT_FAST32_T) :: x = -2147483647 ++ integer(C_INT_FAST32_T) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INT_FAST32_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INT_FAST32_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main006.f90 b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main006.f90 +new file mode 100644 +index 0000000..681705c +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/fortran_main006.f90 +@@ -0,0 +1,24 @@ ++! Test fortran call c for composite scenario of type intmax_t ++! ++program main ++ use iso_c_binding ++ type, bind(c) :: base ++ integer(C_INTMAX_T) :: j(2) = -2 ++ end type base ++ type, bind(c) :: t ++ type(base) :: bt ++ integer(C_INTMAX_T) :: x = -2147483647 ++ integer(C_INTMAX_T) :: y = 2147483647 ++ end type t ++ type(t) :: my_t ++ integer(C_INTMAX_T) :: my_x = 3 ++ interface ++ subroutine c_func(a, b) ++ use iso_c_binding ++ import :: t ++ type(t) :: a ++ integer(C_INTMAX_T) :: b ++ end ++ end interface ++ call c_func(my_t, my_x) ++end +diff --git a/test/interoperability_with_c/015_fortran_call_c_special_case/run.sh b/test/interoperability_with_c/015_fortran_call_c_special_case/run.sh +new file mode 100644 +index 0000000..5ad075b +--- /dev/null ++++ b/test/interoperability_with_c/015_fortran_call_c_special_case/run.sh +@@ -0,0 +1,17 @@ ++for i in {001..006} ++do ++echo "------- test $i ------." ++#echo "----- gfortran result:" ++#gcc c_func$i.c -c -o c-test.o ++#gfortran fortran_main$i.f90 -fno-range-check -c -o fortran-test.o ++#gfortran c-test.o fortran-test.o ++#./a.out ++#rm *.o a.out ++echo "----- flang-new result : " ++clang c_func$i.c -c -o c-test.o ++flang-new fortran_main$i.f90 -c -o fortran-test.o ++flang-new -flang-experimental-exec c-test.o fortran-test.o ++./a.out ++rm *.o a.out ++done ++ +-- +2.7.4 + diff --git a/flang.spec b/flang.spec index 822d39a..be7169b 100644 --- a/flang.spec +++ b/flang.spec @@ -2,7 +2,7 @@ Name: flang Version: flang_20210324 -Release: 4 +Release: 5 Summary: Fortran language compiler targeting LLVM License: Apache-2.0 @@ -11,6 +11,7 @@ Source0: flang-flang_20210324.tar.gz BuildRequires: gcc Requires: gcc >= 9.3.0 +Patch2: 3-add-tests-interoperability-C.patch %description Flang depends on a fork of the LLVM project (https://github.com/flang-compiler/classic-flang-llvm-project). The fork made some changes to the upstream LLVM project to support Flang toolchain. Flang cannot build independently for now. @@ -32,6 +33,9 @@ TODO: support build Flang. %changelog +* Thu Sep 8 2022 a - flang_20210324-7 +- Add test cases for interoperability with C about fortran call C + * Thu Jul 14 2022 qiaopeixin - flang_20210324-4 - Add patch for inline of runtime functions -- Gitee