diff --git a/flang/lib/Semantics/check-omp-structure.h b/flang/lib/Semantics/check-omp-structure.h index 33243d926cf16..8287653458e1c 100644 --- a/flang/lib/Semantics/check-omp-structure.h +++ b/flang/lib/Semantics/check-omp-structure.h @@ -42,6 +42,7 @@ static const OmpDirectiveSet noWaitClauseNotAllowedSet{ Directive::OMPD_do_simd, Directive::OMPD_sections, Directive::OMPD_single, + Directive::OMPD_workshare, }; } // namespace omp } // namespace llvm diff --git a/flang/test/Semantics/OpenMP/clause-validity01.f90 b/flang/test/Semantics/OpenMP/clause-validity01.f90 index 977a529864615..74f154bb0ad67 100644 --- a/flang/test/Semantics/OpenMP/clause-validity01.f90 +++ b/flang/test/Semantics/OpenMP/clause-validity01.f90 @@ -342,6 +342,9 @@ a = 1.0 !ERROR: COPYPRIVATE clause is not allowed on the END WORKSHARE directive !$omp end workshare nowait copyprivate(a) + !$omp workshare nowait + !ERROR: NOWAIT clause is not allowed on the WORKSHARE directive, use it on OMP END WORKSHARE directive + !$omp end workshare !$omp end parallel ! 2.8.1 simd-clause -> safelen-clause | diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td index d9a931438b429..e91169e8da1aa 100644 --- a/llvm/include/llvm/Frontend/OpenMP/OMP.td +++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -2115,6 +2115,9 @@ def OMP_scope : Directive<"scope"> { let association = AS_Block; } def OMP_Workshare : Directive<"workshare"> { + let allowedOnceClauses = [ + VersionedClause + ]; let association = AS_Block; } def OMP_ParallelWorkshare : Directive<"parallel workshare"> {