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