[flang] Allow POINTER attribute statement on procedure interfaces

A POINTER attribute statement is allowed to add the POINTER attribute
to a procedure entity that has already been declared, e.g. with an
INTERFACE block.

Differential Revision: https://reviews.llvm.org/D123732
This commit is contained in:
Peter Klausler 2022-04-11 18:57:59 -07:00
parent 468c7b65e5
commit de6e88ef5a
2 changed files with 2 additions and 3 deletions

View File

@ -3758,8 +3758,7 @@ void DeclarationVisitor::Post(const parser::PointerDecl &x) {
symbol.ReplaceName(name.source);
EndArraySpec();
} else {
Symbol &symbol{DeclareUnknownEntity(name, Attrs{Attr::POINTER})};
symbol.ReplaceName(name.source);
HandleAttributeStmt(Attr::POINTER, std::get<parser::Name>(x.t));
}
}

View File

@ -15,11 +15,11 @@ contains
subroutine s0
!ERROR: 'p1' may not have both the POINTER and TARGET attributes
real, pointer :: p1, p3
!ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes
allocatable :: p2
!ERROR: 'sin' may not have both the POINTER and INTRINSIC attributes
real, intrinsic, pointer :: sin
target :: p1
!ERROR: 'p2' may not have both the POINTER and ALLOCATABLE attributes
pointer :: p2
!ERROR: 'a' may not have the POINTER attribute because it is a coarray
real, pointer :: a(:)[*]