From de6e88ef5a5deb2661e16d3ab608eb3c77604136 Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Mon, 11 Apr 2022 18:57:59 -0700 Subject: [PATCH] [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 --- flang/lib/Semantics/resolve-names.cpp | 3 +-- flang/test/Semantics/assign02.f90 | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index 283dffb019b3..85b5f3a9c608 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -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(x.t)); } } diff --git a/flang/test/Semantics/assign02.f90 b/flang/test/Semantics/assign02.f90 index 6e65d9014938..4a0b37234219 100644 --- a/flang/test/Semantics/assign02.f90 +++ b/flang/test/Semantics/assign02.f90 @@ -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(:)[*]