1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic
7 integer, target
:: targ
11 subroutine test(assumedType
, poly
, nclen
, n
)
12 type(*), target
:: assumedType
13 class(*), target
:: poly
17 !PORTABILITY: Procedure pointer 'pptr' should not have an ELEMENTAL intrinsic as its interface
18 procedure(sin
), pointer :: pptr
19 real, target
:: arr(3)
20 type(hasLen(1)), target
:: clen
21 type(hasLen(*)), target
:: nclen
22 integer, intent(in
) :: n
23 character(2), target
:: ch
24 character(1,4), target
:: unicode
25 real :: arr1(purefun1(c_loc(targ
))) ! ok
26 real :: arr2(purefun2(c_funloc(subr
))) ! ok
27 character(:), allocatable
, target
:: deferred
28 character(n
), pointer :: p2ch
29 !ERROR: C_LOC() argument must be a data pointer or target
30 cp
= c_loc(notATarget
)
31 !ERROR: C_LOC() argument must be a data pointer or target
33 !ERROR: C_LOC() argument must be contiguous
34 cp
= c_loc(arr(1:3:2))
35 !ERROR: C_LOC() argument may not be a zero-sized array
37 !ERROR: C_LOC() argument must have an intrinsic type, assumed type, or non-polymorphic derived type with no non-constant length parameter
40 !ERROR: C_LOC() argument must have an intrinsic type, assumed type, or non-polymorphic derived type with no non-constant length parameter
42 !ERROR: C_LOC() argument may not be zero-length character
44 !WARNING: C_LOC() argument has non-interoperable character length
46 !WARNING: C_LOC() argument has non-interoperable intrinsic type or kind
48 cp
= c_loc(ch(1:1)) ! ok
49 cp
= c_loc(deferred
) ! ok
51 !ERROR: PRIVATE name '__address' is only accessible within module '__fortran_builtins'
53 !ERROR: PRIVATE name '__address' is only accessible within module '__fortran_builtins'
55 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(c_ptr) and TYPE(c_funptr)
57 !ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types TYPE(c_funptr) and TYPE(c_ptr)
60 pure
integer function purefun1(p
)
61 type(c_ptr
), intent(in
) :: p
64 pure
integer function purefun2(p
)
65 type(c_funptr
), intent(in
) :: p