1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
3 ! NULL() intrinsic function error tests
10 integer, intent(in
) :: j
17 real, intent(inout
) :: x
22 procedure(s0
), pointer, intent(inout
) :: p
26 procedure(s1
), pointer :: f3
30 integer, pointer :: ip0
33 integer, pointer :: ip1(:)
36 procedure(s0
), pointer, nopass
:: pps0
39 procedure(s1
), pointer, nopass
:: pps1
46 integer, pointer :: ip0
, ip1(:), ip2(:,:)
47 integer, allocatable
:: ia0
, ia1(:), ia2(:,:)
48 real, pointer :: rp0
, rp1(:)
49 integer, parameter :: ip0r
= rank(null(mold
=ip0
))
50 integer, parameter :: ip1r
= rank(null(mold
=ip1
))
51 integer, parameter :: ip2r
= rank(null(mold
=ip2
))
52 integer, parameter :: eight
= ip0r
+ ip1r
+ ip2r
+ 5
53 real(kind
=eight
) :: r8check
57 !ERROR: MOLD= argument to NULL() must be a pointer or allocatable
59 !ERROR: MOLD= argument to NULL() must be a pointer or allocatable
62 dt0x
= dt0(ip0
=null())
63 dt0x
= dt0(ip0
=null(ip0
))
64 dt0x
= dt0(ip0
=null(mold
=ip0
))
65 !ERROR: function result type 'REAL(4)' is not compatible with pointer type 'INTEGER(4)'
66 !ERROR: pointer 'ip0' is associated with the result of a reference to function 'null' whose pointer result has an incompatible type or shape
67 dt0x
= dt0(ip0
=null(mold
=rp0
))
68 !ERROR: function result type 'REAL(4)' is not compatible with pointer type 'INTEGER(4)'
69 !ERROR: pointer 'ip1' is associated with the result of a reference to function 'null' whose pointer result has an incompatible type or shape
70 dt1x
= dt1(ip1
=null(mold
=rp1
))
71 dt2x
= dt2(pps0
=null())
72 dt2x
= dt2(pps0
=null(mold
=dt2x
%pps0
))
73 !ERROR: Procedure pointer 'pps0' associated with result of reference to function 'null' that is an incompatible procedure pointer
74 dt2x
= dt2(pps0
=null(mold
=dt3x
%pps1
))
75 !ERROR: Procedure pointer 'pps1' associated with result of reference to function 'null' that is an incompatible procedure pointer
76 dt3x
= dt3(pps1
=null(mold
=dt2x
%pps0
))
77 dt3x
= dt3(pps1
=null(mold
=dt3x
%pps1
))