1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3! Check for semantic errors in NULLIFY statements
4
5INTEGER, PARAMETER :: maxvalue=1024
6
7Type dt
8  Integer :: l = 3
9End Type
10Type t
11  Type(dt) :: p
12End Type
13
14Type(t),Allocatable :: x(:)
15
16Integer :: pi
17Procedure(Real) :: prp
18
19Allocate(x(3))
20!ERROR: component in NULLIFY statement must have the POINTER attribute
21Nullify(x(2)%p)
22
23!ERROR: name in NULLIFY statement must have the POINTER attribute
24Nullify(pi)
25
26!ERROR: name in NULLIFY statement must have the POINTER attribute
27Nullify(prp)
28
29!ERROR: name in NULLIFY statement must be a variable or procedure pointer name
30Nullify(maxvalue)
31
32End Program
33
34! Make sure that the compiler doesn't crash when NULLIFY is used in a context
35! that has reported errors
36module badNullify
37  interface
38    module function ptrFun()
39      integer, pointer :: ptrFun
40    end function
41  end interface
42contains
43  !ERROR: 'ptrfun' was not declared a separate module procedure
44  module function ptrFun()
45    integer, pointer :: ptrFun
46    real :: realVar
47    nullify(ptrFun)
48    nullify(realVar)
49  end function
50end module
51