[flang-commits] [PATCH] D88556: [Flang][OpenMP] Fix issue in only a single nowait clause can appear on a sections directive.
sameeran joshi via Phabricator via flang-commits
flang-commits at lists.llvm.org
Wed Sep 30 04:51:31 PDT 2020
sameeranjoshi created this revision.
sameeranjoshi added reviewers: DavidTruby, kiranchandramohan, kiranktp, clementval, SouraVX.
sameeranjoshi added a project: Flang.
Herald added subscribers: guansong, yaxunl.
Herald added a reviewer: jdoerfert.
sameeranjoshi requested review of this revision.
Herald added a subscriber: sstefan1.
The OpenMP 5.0 standard restricts nowait clause to appear only once on sections
directive.
See OpenMP 5.0
- 2.8.1
- point 3 in restrictions.
Added a test with fix.
https://reviews.llvm.org/D88556
Files:
flang/lib/Semantics/check-omp-structure.cpp
flang/test/Semantics/omp-clause-validity01.f90
Index: flang/test/Semantics/omp-clause-validity01.f90
===================================================================
--- flang/test/Semantics/omp-clause-validity01.f90
+++ flang/test/Semantics/omp-clause-validity01.f90
@@ -261,6 +261,17 @@
d = 2
!ERROR: NUM_THREADS clause is not allowed on the END SECTIONS directive
!$omp end sections num_threads(4)
+
+ !$omp parallel
+ !$omp sections
+ b = 1
+ !$omp section
+ c = 1
+ d = 2
+ !ERROR: At most one NOWAIT clause can appear on the END SECTIONS directive
+ !$omp end sections nowait nowait
+ !$omp end parallel
+
!$omp end parallel
! 2.11.2 parallel-sections-clause -> parallel-clause |
Index: flang/lib/Semantics/check-omp-structure.cpp
===================================================================
--- flang/lib/Semantics/check-omp-structure.cpp
+++ flang/lib/Semantics/check-omp-structure.cpp
@@ -127,7 +127,7 @@
// 2.7.2 end-sections -> END SECTIONS [nowait-clause]
case llvm::omp::Directive::OMPD_sections:
SetContextDirectiveEnum(llvm::omp::Directive::OMPD_end_sections);
- SetContextAllowed(OmpClauseSet{llvm::omp::Clause::OMPC_nowait});
+ SetContextAllowedOnce(OmpClauseSet{llvm::omp::Clause::OMPC_nowait});
break;
default:
// no clauses are allowed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88556.295242.patch
Type: text/x-patch
Size: 1281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20200930/a28e1d54/attachment-0001.bin>
More information about the flang-commits
mailing list