When an explicit MODULE procedure is defined in the same (sub)module as its interface, and the interface was defined in a generic interface of the same name, bogus errors about symbols already having been defined will ensue. Cleaning up this aspect of name resolution and symbol table management requires marking the place-holding SubprogramNameDetails symbols of explicit MODULE subprograms as such, ensuring that that attribute is not inherited if the SubprogramNameDetails symbol is recycled as a SubprogramDetails, and gathering some code that should have been common between BeginSubprogram() and BeginMpSubprogram() together in one new routine. Differential Revision: https://reviews.llvm.org/D134446
52 lines
1.2 KiB
Fortran
52 lines
1.2 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
|
|
!ERROR: 'ptrfun' is already declared in this scoping unit
|
|
module function ptrFun()
|
|
integer, pointer :: ptrFun
|
|
real :: realVar
|
|
nullify(ptrFun)
|
|
!ERROR: name in NULLIFY statement must have the POINTER attribute
|
|
nullify(realVar)
|
|
end function
|
|
end module
|