2021-09-06 16:19:20 +08:00
|
|
|
! RUN: %python %S/test_errors.py %s %flang_fc1
|
2019-04-08 15:26:10 +08:00
|
|
|
! Check for semantic errors in NULLIFY statements
|
|
|
|
|
2019-04-08 02:29:48 +08:00
|
|
|
INTEGER, PARAMETER :: maxvalue=1024
|
|
|
|
|
|
|
|
Type dt
|
|
|
|
Integer :: l = 3
|
|
|
|
End Type
|
|
|
|
Type t
|
|
|
|
Type(dt) :: p
|
|
|
|
End Type
|
|
|
|
|
|
|
|
Type(t),Allocatable :: x(:)
|
|
|
|
|
|
|
|
Integer :: pi
|
|
|
|
Procedure(Real) :: prp
|
|
|
|
|
|
|
|
Allocate(x(3))
|
2019-04-08 15:26:10 +08:00
|
|
|
!ERROR: component in NULLIFY statement must have the POINTER attribute
|
2019-04-08 02:29:48 +08:00
|
|
|
Nullify(x(2)%p)
|
|
|
|
|
2019-04-08 15:26:10 +08:00
|
|
|
!ERROR: name in NULLIFY statement must have the POINTER attribute
|
2019-04-08 02:29:48 +08:00
|
|
|
Nullify(pi)
|
|
|
|
|
2019-04-08 15:26:10 +08:00
|
|
|
!ERROR: name in NULLIFY statement must have the POINTER attribute
|
2019-04-08 02:29:48 +08:00
|
|
|
Nullify(prp)
|
|
|
|
|
2019-04-08 15:26:10 +08:00
|
|
|
!ERROR: name in NULLIFY statement must be a variable or procedure pointer name
|
2019-04-08 02:29:48 +08:00
|
|
|
Nullify(maxvalue)
|
|
|
|
|
|
|
|
End Program
|
2021-03-09 00:21:30 +08:00
|
|
|
|
|
|
|
! Make sure that the compiler doesn't crash when NULLIFY is used in a context
|
|
|
|
! that has reported errors
|
|
|
|
module badNullify
|
|
|
|
interface
|
|
|
|
module function ptrFun()
|
|
|
|
integer, pointer :: ptrFun
|
|
|
|
end function
|
|
|
|
end interface
|
|
|
|
contains
|
|
|
|
!ERROR: 'ptrfun' was not declared a separate module procedure
|
|
|
|
module function ptrFun()
|
|
|
|
integer, pointer :: ptrFun
|
|
|
|
real :: realVar
|
|
|
|
nullify(ptrFun)
|
|
|
|
nullify(realVar)
|
|
|
|
end function
|
|
|
|
end module
|