2009-10-05 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / c_loc_tests_14.f90
blobec455eca924beb589148a1b5892e57b6c30e8cda
1 ! { dg-do compile }
3 ! PR fortran/38536
4 ! Accept as argument to C_LOC a subcomponent accessed through a pointer.
6 USE ISO_C_BINDING
8 IMPLICIT NONE
9 TYPE test3
10 INTEGER, DIMENSION(5) :: b
11 END TYPE test3
13 TYPE test2
14 TYPE(test3), DIMENSION(:), POINTER :: a
15 END TYPE test2
17 TYPE test
18 TYPE(test2), DIMENSION(2) :: c
19 END TYPE test
21 TYPE(test) :: chrScalar
22 TYPE(C_PTR) :: f_ptr
23 TYPE(test3), TARGET :: d(3)
26 chrScalar%c(1)%a => d
27 f_ptr = C_LOC(chrScalar%c(1)%a(1)%b(1))
28 end