1! { dg-do compile }
2! { dg-options "-std=f2003" }
3
4subroutine foo(a,b,c,d)
5   use iso_c_binding, only: c_loc, c_ptr
6   implicit none
7   real, intent(in), target :: a(:)
8   real, intent(in), target :: b(5)
9   real, intent(in), target :: c(*)
10   real, intent(in), target, allocatable :: d(:)
11   type(c_ptr) :: ptr
12   ptr = C_LOC(b)
13   ptr = C_LOC(c)
14   ptr = C_LOC(d)
15   ptr = C_LOC(a) ! { dg-error "Fortran 2008: Array of interoperable type at .1. to C_LOC which is nonallocatable and neither assumed size nor explicit size" }
16end subroutine foo
17