| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! TS 29113 |
| 4 |
! 8.1 Removed restrictions on ISO_C_BINDING module procedures |
| 5 |
! |
| 6 |
! The function C_LOC from the intrinsic module ISO_C_BINDING has the |
| 7 |
! restriction in ISO/IEC 1539-1:2010 that if X is an array, it shall |
| 8 |
! be of interoperable type. |
| 9 |
! |
| 10 |
! [...] |
| 11 |
! |
| 12 |
! These restrictions are removed. |
| 13 |
|
| 14 |
module m |
| 15 |
use ISO_C_BINDING |
| 16 |
implicit none |
| 17 |
|
| 18 |
! An obvious example of a type that isn't interoperable is a |
| 19 |
! derived type without a bind(c) clause. |
| 20 |
|
| 21 |
integer :: buflen |
| 22 |
parameter (buflen=256) |
| 23 |
|
| 24 |
type :: packet |
| 25 |
integer :: size |
| 26 |
integer(1) :: buf(buflen) |
| 27 |
end type |
| 28 |
|
| 29 |
contains |
| 30 |
|
| 31 |
subroutine test (packets, ptr) |
| 32 |
type(packet), pointer, intent(in) :: packets(:) |
| 33 |
type(C_PTR), intent(out) :: ptr |
| 34 |
|
| 35 |
ptr = c_loc (packets) |
| 36 |
end subroutine |
| 37 |
end module |