diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -668,6 +668,8 @@ case parser::OmpSimpleStandaloneDirective::Directive::Taskwait: { // 2.13.4 taskwait PushContext(dir.source, OmpDirective::TASKWAIT); + OmpClauseSet allowed{OmpClause::DEPEND, OmpClause::NOWAIT}; + SetContextAllowed(allowed); } break; case parser::OmpSimpleStandaloneDirective::Directive::Taskyield: { // 2.9.4 taskyield diff --git a/flang/test/Semantics/omp-clause-validity01.f90 b/flang/test/Semantics/omp-clause-validity01.f90 --- a/flang/test/Semantics/omp-clause-validity01.f90 +++ b/flang/test/Semantics/omp-clause-validity01.f90 @@ -396,6 +396,11 @@ !$omp taskyield !$omp barrier !$omp taskwait + !$omp taskwait nowait + !$omp taskwait depend(source) + !$omp taskwait depend(source) nowait + !ERROR: Internal: no symbol found for 'i' + !$omp taskwait depend(sink:i-1) ! !$omp target enter data map(to:arrayA) map(alloc:arrayB) ! !$omp target update from(arrayA) to(arrayB) ! !$omp target exit data map(from:arrayA) map(delete:arrayB)