]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.f90
2019-04-14 Paul Thomas <pault@gcc.gnu.org>
[thirdparty/gcc.git] / gcc / testsuite / gfortran.dg / ISO_Fortran_binding_9.f90
1 ! { dg-do run { target c99_runtime } }
2 ! { dg-additional-sources ISO_Fortran_binding_9.c }
3 !
4 ! Fix a problem with CFI_is_contiguous
5 !
6 ! Contributed by Gilles Gouaillardet <gilles@rist.or.jp>
7 !
8 module cdesc
9 interface
10 function cdesc_f08(buf, expected) result (res) BIND(C, name="cdesc_c")
11 USE, INTRINSIC :: ISO_C_BINDING
12 implicit none
13 INTEGER(C_INT) :: res
14 type(*), dimension(..), INTENT(IN) :: buf
15 integer(kind=kind(loc(res))),INTENT(IN) :: expected
16 end function cdesc_f08
17 end interface
18 end module
19
20 program cdesc_test
21 use cdesc
22 implicit none
23 integer :: a0, a1(10), a2(10,10), a3(10,10,10)
24 if (cdesc_f08(a0, LOC(a0)) .ne. 1) stop 1
25 if (cdesc_f08(a1, LOC(a1(1))) .ne. 1) stop 2
26 if (cdesc_f08(a2, LOC(a2(1,1))) .ne. 1) stop 3
27 if (cdesc_f08(a3, LOC(a3(1,1,1))) .ne. 1) stop 4
28 end program