Debian Codegraph @

gcc/testsuite/gfortran.dg/c_loc_test_17.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR fortran/56378
4 ! PR fortran/52426
5 !
6 ! Contributed by David Sagan & Joost VandeVondele
7 !
8
9 module t
10 use, intrinsic :: iso_c_binding
11 interface fvec2vec
12 module procedure int_fvec2vec
13 end interface
14 contains
15 function int_fvec2vec (f_vec, n) result (c_vec)
16 integer f_vec(:)
17 integer(c_int), target :: c_vec(n)
18 end function int_fvec2vec
19 subroutine lat_to_c (Fp, C) bind(c)
20 integer, allocatable :: ic(:)
21 call lat_to_c2 (c_loc(fvec2vec(ic, n1_ic))) ! { dg-error "Argument X at .1. to C_LOC shall have either the POINTER or the TARGET attribute" }
22 end subroutine lat_to_c
23 end module
24
25 use iso_c_binding
26 type(c_ptr) :: i
27 i = c_loc([1]) ! { dg-error "Argument X at .1. to C_LOC shall have either the POINTER or the TARGET attribute" }
28 end