[flang-commits] [flang] 65af17c - [flang][OpenMP][OpenACC] Fix exit of a region
via flang-commits
flang-commits at lists.llvm.org
Sat May 28 01:36:11 PDT 2022
Author: Peixin-Qiao
Date: 2022-05-28T16:34:26+08:00
New Revision: 65af17c7a00df3f8906cded34b63b309e687cf61
URL: https://github.com/llvm/llvm-project/commit/65af17c7a00df3f8906cded34b63b309e687cf61
DIFF: https://github.com/llvm/llvm-project/commit/65af17c7a00df3f8906cded34b63b309e687cf61.diff
LOG: [flang][OpenMP][OpenACC] Fix exit of a region
The stop statement is allowed in OpenMP/OpenACC block region.
Reviewed By: kiranchandramohan, shraiysh
Differential Revision: https://reviews.llvm.org/D126471
Added:
Modified:
flang/lib/Semantics/check-directive-structure.h
flang/test/Semantics/OpenACC/acc-branch.f90
flang/test/Semantics/omp-parallel02.f90
flang/test/Semantics/omp-task01.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h
index 4dc653071ef8..6444e839967d 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -58,7 +58,6 @@ template <typename D> class NoBranchingEnforce {
CheckConstructNameBranching("EXIT");
}
}
- void Post(const parser::StopStmt &) { EmitBranchOutError("STOP"); }
void Post(const parser::CycleStmt &cycleStmt) {
if (const auto &cycleName{cycleStmt.v}) {
CheckConstructNameBranching("CYCLE", cycleName.value());
diff --git a/flang/test/Semantics/OpenACC/acc-branch.f90 b/flang/test/Semantics/OpenACC/acc-branch.f90
index 06c3b4da9292..ec6280b88d58 100644
--- a/flang/test/Semantics/OpenACC/acc-branch.f90
+++ b/flang/test/Semantics/OpenACC/acc-branch.f90
@@ -93,8 +93,7 @@ program openacc_clause_validity
do i = 1, N
a(i) = 3.14
if(i == N-1) THEN
- !ERROR: STOP statement is not allowed in a PARALLEL construct
- stop 999
+ stop 999 ! no error
end if
end do
!$acc end parallel
@@ -120,8 +119,7 @@ program openacc_clause_validity
do i = 1, N
a(i) = 3.14
if(i == N-1) THEN
- !ERROR: STOP statement is not allowed in a KERNELS construct
- stop 999
+ stop 999 ! no error
end if
end do
!$acc end kernels
@@ -163,8 +161,7 @@ program openacc_clause_validity
do i = 1, N
a(i) = 3.14
if(i == N-1) THEN
- !ERROR: STOP statement is not allowed in a SERIAL construct
- stop 999
+ stop 999 ! no error
end if
end do
!$acc end serial
diff --git a/flang/test/Semantics/omp-parallel02.f90 b/flang/test/Semantics/omp-parallel02.f90
index 59032e17c6ae..eff0e7c70d1a 100644
--- a/flang/test/Semantics/omp-parallel02.f90
+++ b/flang/test/Semantics/omp-parallel02.f90
@@ -15,7 +15,6 @@ program omp_parallel
do j = 1, 10
print *, "Hello"
!CHECK: In the enclosing PARALLEL directive branched into
- !CHECK: STOP statement is not allowed in a PARALLEL construct
10 stop
end do
end do
diff --git a/flang/test/Semantics/omp-task01.f90 b/flang/test/Semantics/omp-task01.f90
index 1206a889e837..4dc80d6d70e0 100644
--- a/flang/test/Semantics/omp-task01.f90
+++ b/flang/test/Semantics/omp-task01.f90
@@ -17,7 +17,6 @@ recursive subroutine traverse ( P )
!$omp task
call traverse(P%left)
!CHECK: In the enclosing TASK directive branched into
- !CHECK: STOP statement is not allowed in a TASK construct
10 stop
!$omp end task
endif
More information about the flang-commits
mailing list