1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Tests valid and invalid NULL initializers
6 !ERROR: No explicit type declared for 'null'
13 integer, pointer :: p
=> null()
18 integer, pointer :: p
=> null()
23 integer, pointer :: p
=> null()
28 !ERROR: Pointer initializer must be intrinsic NULL()
29 integer, pointer :: p
=> null()
33 !ERROR: Symbol 'null' cannot have both INTRINSIC and EXTERNAL attributes
34 integer, pointer :: p
=> null()
40 function null() result(p
)
44 !ERROR: Pointer initializer must be intrinsic NULL()
45 integer, pointer :: p
=> null()
49 integer, pointer :: p
=> null()
51 !ERROR: 'null' is already declared in this scoping unit
52 function null() result(p
)
62 integer, pointer :: foo
67 use m9a
, renamed
=> null
, null
=> foo
68 integer, pointer :: p
=> renamed()
69 !ERROR: Pointer initializer must be intrinsic NULL()
70 integer, pointer :: q
=> null()
71 integer, pointer :: d1
, d2
73 !ERROR: An initial data target must be a designator with constant subscripts
79 !ERROR: 'null' must be an array or structure constructor if used with non-empty parentheses as a DATA statement constant
88 integer, parameter :: j
= 0
89 data obj
/null(mold
=j
), null(j
)/ ! both fine
93 integer, parameter :: j
= 1
94 integer, target
, save :: null(1)
100 integer, external, pointer :: p1
=> null()
101 procedure(), pointer :: p2
=> null()