diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/c_loc_test_21.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/c_loc_test_21.f90 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/c_loc_test_21.f90 b/gcc/testsuite/gfortran.dg/c_loc_test_21.f90 new file mode 100644 index 0000000000..a31ca034fb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/c_loc_test_21.f90 @@ -0,0 +1,16 @@ +! { dg-do compile } +! { dg-options "-std=f2003" } + +subroutine foo(a,b,c,d) + use iso_c_binding, only: c_loc, c_ptr + implicit none + real, intent(in), target :: a(:) + real, intent(in), target :: b(5) + real, intent(in), target :: c(*) + real, intent(in), target, allocatable :: d(:) + type(c_ptr) :: ptr + ptr = C_LOC(b) + ptr = C_LOC(c) + ptr = C_LOC(d) + 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" } +end subroutine foo |