[flang-commits] [PATCH] D132681: [flang] Allow a construct entity as a concurrent-header index
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Aug 25 10:49:12 PDT 2022
klausler created this revision.
klausler added a reviewer: jeanPerier.
klausler added a project: Flang.
Herald added subscribers: jdoerfert, arphaman.
Herald added a project: All.
klausler requested review of this revision.
A construct entity of an ASSOCIATE or SELECT TYPE construct
should be acceptable as an index variable of a concurrent-header in
a FORALL or DO CONCURRENT, so long as it also satisfies other
requirements.
https://reviews.llvm.org/D132681
Files:
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/forall01.f90
Index: flang/test/Semantics/forall01.f90
===================================================================
--- flang/test/Semantics/forall01.f90
+++ flang/test/Semantics/forall01.f90
@@ -110,3 +110,25 @@
a(1)%p => b(i)
end forall
end
+
+subroutine forall7(x)
+ integer :: iarr(1)
+ real :: a(10)
+ class(*) :: x
+ associate (j => iarr(1))
+ forall (j=1:size(a))
+ a(j) = a(j) + 1
+ end forall
+ end associate
+ associate (j => iarr(1) + 1)
+ forall (j=1:size(a))
+ a(j) = a(j) + 1
+ end forall
+ end associate
+ select type (j => x)
+ type is (integer)
+ forall (j=1:size(a))
+ a(j) = a(j) + 1
+ end forall
+ end select
+end subroutine
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -5883,10 +5883,10 @@
} else if (!prev) {
ApplyImplicitRules(symbol);
} else {
- const Symbol &prevRoot{ResolveAssociations(*prev)};
+ const Symbol &prevRoot{prev->GetUltimate()};
// prev could be host- use- or construct-associated with another symbol
if (!prevRoot.has<ObjectEntityDetails>() &&
- !prevRoot.has<EntityDetails>()) {
+ !prevRoot.has<AssocEntityDetails>()) {
Say2(name, "Index name '%s' conflicts with existing identifier"_err_en_US,
*prev, "Previous declaration of '%s'"_en_US);
context().SetError(symbol);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132681.455649.patch
Type: text/x-patch
Size: 1477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220825/909f9ea4/attachment.bin>
More information about the flang-commits
mailing list