Skip to content

Commit ab3fba8

Browse files
committed
Allow do concurrent in loop constructs, but not loop nests
1 parent 3649ab1 commit ab3fba8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1952,7 +1952,8 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndexAndCheckLoopLevel(
19521952
const auto &outer{std::get<std::optional<parser::DoConstruct>>(x.t)};
19531953
if (outer.has_value()) {
19541954
for (const parser::DoConstruct *loop{&*outer}; loop && level > 0; --level) {
1955-
if (loop->IsDoConcurrent()) {
1955+
// DO CONCURRENT is allowed for loop constructs but not loop nests
1956+
if (loop->IsDoConcurrent() && GetContext().associatedLoopLevel != 1) {
19561957
auto &stmt =
19571958
std::get<parser::Statement<parser::NonLabelDoStmt>>(loop->t);
19581959
context_.Say(stmt.source,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
! RUN: %not_todo_cmd bbc -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
2+
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
3+
4+
! CHECK: not yet implemented: Do Concurrent in Worksharing loop construct
5+
subroutine sb()
6+
!$omp do
7+
do concurrent(i=1:10)
8+
print *, i
9+
end do
10+
end subroutine

0 commit comments

Comments
 (0)