[flang-commits] [flang] de6e88e - [flang] Allow POINTER attribute statement on procedure interfaces
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Apr 15 20:21:07 PDT 2022
Author: Peter Klausler
Date: 2022-04-15T20:20:56-07:00
New Revision: de6e88ef5a5deb2661e16d3ab608eb3c77604136
URL: https://github.com/llvm/llvm-project/commit/de6e88ef5a5deb2661e16d3ab608eb3c77604136
DIFF: https://github.com/llvm/llvm-project/commit/de6e88ef5a5deb2661e16d3ab608eb3c77604136.diff
LOG: [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
Added:
Modified:
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/assign02.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 283dffb019b3b..85b5f3a9c6080 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<parser::Name>(x.t));
}
}
diff --git a/flang/test/Semantics/assign02.f90 b/flang/test/Semantics/assign02.f90
index 6e65d9014938a..4a0b372342193 100644
--- a/flang/test/Semantics/assign02.f90
+++ b/flang/test/Semantics/assign02.f90
@@ -15,11 +15,11 @@ module m1
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(:)[*]
More information about the flang-commits
mailing list