gcc/testsuite/gfortran.dg/c_loc_tests_5.f03
raw| 1 | ! { dg-do compile } |
| 2 | module c_loc_tests_5 |
| 3 | use, intrinsic :: iso_c_binding, only: c_char, c_ptr, c_loc, c_int |
| 4 | |
| 5 | contains |
| 6 | subroutine sub0() bind(c) |
| 7 | type(c_ptr) :: f_ptr, my_c_ptr |
| 8 | character(kind=c_char, len=20), target :: format |
| 9 | integer(c_int), dimension(:), pointer :: int_ptr |
| 10 | integer(c_int), dimension(10), target :: int_array |
| 11 | |
| 12 | f_ptr = c_loc(format(1:1)) |
| 13 | |
| 14 | int_ptr => int_array |
| 15 | my_c_ptr = c_loc(int_ptr(0)) |
| 16 | |
| 17 | end subroutine sub0 |
| 18 | end module c_loc_tests_5 |