1! { dg-do compile }
2! { dg-options "-fcoarray=single -std=f2008" }
3! PR 38536 - array sections as arguments to c_loc are illegal.
4  use iso_c_binding
5  type, bind(c) :: t1
6     integer(c_int) :: i(5)
7  end type t1
8  type, bind(c):: t2
9     type(t1) :: t(5)
10  end type t2
11  type, bind(c) :: t3
12     type(t1) :: t(5,5)
13  end type t3
14
15  type(t2), target :: tt
16  type(t3), target :: ttt
17  integer(c_int), target :: n(3)
18  integer(c_int), target :: x[*]
19  type(C_PTR) :: p
20
21  p = c_loc(tt%t%i(1))
22  p = c_loc(n(1:2))  ! OK: interop type + contiguous
23  p = c_loc(ttt%t(5,1:2)%i(1)) ! FIXME: Noncontiguous (invalid) - compile-time testable
24  p = c_loc(x[1]) ! { dg-error "shall not be coindexed" }
25  end
26