Debian Codegraph @

gcc/testsuite/gfortran.dg/c_loc_tests_4.f03

raw
1 ! { dg-do compile }
2 ! { dg-options "-std=f2003" }
3 !
4 module c_loc_tests_4
5 use, intrinsic :: iso_c_binding
6 implicit none
7
8 contains
9 subroutine sub0() bind(c)
10 integer(c_int), target, dimension(10) :: my_array
11 integer(c_int), pointer, dimension(:) :: my_array_ptr
12 type(c_ptr) :: my_c_ptr
13
14 my_array_ptr => my_array
15 my_c_ptr = c_loc(my_array_ptr) ! { dg-error "Fortran 2008: Array of interoperable type at .1. to C_LOC which is nonallocatable and neither assumed size nor explicit size" }
16 end subroutine sub0
17 end module c_loc_tests_4