Files
clang-p2996/flang/test/Semantics/nullify02.f90
Peter Klausler 8594b051fb [flang] Accept POINTER followed by INTERFACE
As is already supported for dummy procedures, we need to also accept
declarations of procedure pointers that consist of a POINTER attribute
statement followed by an INTERFACE block.  (The case of an INTERFACE
block followed by a POINTER statement already works.)

While cleaning this case up, adjust the utility predicate IsProcedurePointer()
to recognize it (namely a SubprogramDetails symbol with Attr::POINTER)
and delete IsProcName().  Extend tests, and add better comments to
symbol.h to document the two ways in which procedure pointers are
represented.

Differential Revision: https://reviews.llvm.org/D125139
2022-05-09 18:37:09 -07:00

50 lines
1.1 KiB
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Check for semantic errors in NULLIFY statements
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))
!ERROR: component in NULLIFY statement must have the POINTER attribute
Nullify(x(2)%p)
!ERROR: name in NULLIFY statement must have the POINTER attribute
Nullify(pi)
!ERROR: name in NULLIFY statement must be a variable or procedure pointer
Nullify(prp)
!ERROR: name in NULLIFY statement must be a variable or procedure pointer
Nullify(maxvalue)
End Program
! Make sure that the compiler doesn't crash when NULLIFY is used in a context
! that has reported errors
module badNullify
interface
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