view gcc/testsuite/gfortran.dg/c_loc_test_21.f90 @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { 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