1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! NULL() intrinsic function error tests
9 integer, intent(in
) :: j
11 subroutine canbenull(x
, y
)
12 integer, intent(in
), optional
:: x
13 real, intent(in
), pointer :: y
20 real, intent(inout
) :: x
25 procedure(s0
), pointer, intent(inout
) :: p
29 procedure(s1
), pointer :: f3
34 integer, pointer :: ip0
37 integer, pointer :: ip1(:)
40 procedure(s0
), pointer, nopass
:: pps0
43 procedure(s1
), pointer, nopass
:: pps1
50 integer, pointer :: ip0
, ip1(:), ip2(:,:)
51 integer, allocatable
:: ia0
, ia1(:), ia2(:,:)
52 real, pointer :: rp0
, rp1(:)
53 integer, parameter :: ip0r
= rank(null(mold
=ip0
))
54 integer, parameter :: ip1r
= rank(null(mold
=ip1
))
55 integer, parameter :: ip2r
= rank(null(mold
=ip2
))
56 integer, parameter :: eight
= ip0r
+ ip1r
+ ip2r
+ 5
57 real(kind
=eight
) :: r8check
61 !ERROR: MOLD= argument to NULL() must be a pointer or allocatable
63 !ERROR: MOLD= argument to NULL() must be a pointer or allocatable
66 dt0x
= dt0(ip0
=null())
67 dt0x
= dt0(ip0
=null(ip0
))
68 dt0x
= dt0(ip0
=null(mold
=ip0
))
69 !ERROR: function result type 'REAL(4)' is not compatible with pointer type 'INTEGER(4)'
70 dt0x
= dt0(ip0
=null(mold
=rp0
))
71 !ERROR: function result type 'REAL(4)' is not compatible with pointer type 'INTEGER(4)'
72 dt1x
= dt1(ip1
=null(mold
=rp1
))
73 dt2x
= dt2(pps0
=null())
74 dt2x
= dt2(pps0
=null(mold
=dt2x
%pps0
))
75 !ERROR: Procedure pointer 'pps0' associated with result of reference to function 'null' that is an incompatible procedure pointer
76 dt2x
= dt2(pps0
=null(mold
=dt3x
%pps1
))
77 !ERROR: Procedure pointer 'pps1' associated with result of reference to function 'null' that is an incompatible procedure pointer
78 dt3x
= dt3(pps1
=null(mold
=dt2x
%pps0
))
79 dt3x
= dt3(pps1
=null(mold
=dt3x
%pps1
))
80 call canbenull(null(), null()) ! fine
81 call canbenull(null(mold
=ip0
), null(mold
=rp0
)) ! fine
82 !ERROR: Null pointer argument requires an explicit interface
84 !ERROR: Null pointer argument requires an explicit interface
85 call implicit(null(mold
=ip0
))