[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / nullify02.f90
blobbccc1740cebc35604b05e58ea8774cb6189a9805
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Check for semantic errors in NULLIFY statements
5 INTEGER, PARAMETER :: maxvalue=1024
7 Type dt
8 Integer :: l = 3
9 End Type
10 Type t
11 Type(dt) :: p
12 End Type
14 Type(t),Allocatable :: x(:)
16 Integer :: pi
17 Procedure(Real) :: prp
19 Allocate(x(3))
20 !ERROR: component in NULLIFY statement must have the POINTER attribute
21 Nullify(x(2)%p)
23 !ERROR: name in NULLIFY statement must have the POINTER attribute
24 Nullify(pi)
26 !ERROR: name in NULLIFY statement must have the POINTER attribute
27 Nullify(prp)
29 !ERROR: name in NULLIFY statement must be a variable or procedure pointer name
30 Nullify(maxvalue)
32 End Program
34 ! Make sure that the compiler doesn't crash when NULLIFY is used in a context
35 ! that has reported errors
36 module badNullify
37 interface
38 module function ptrFun()
39 integer, pointer :: ptrFun
40 end function
41 end interface
42 contains
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
50 end module