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 @@ -44,7 +44,8 @@ void OmpStructureChecker::CheckAllowed(llvm::omp::Clause type) { if (!GetContext().allowedClauses.test(type) && !GetContext().allowedOnceClauses.test(type) && - !GetContext().allowedExclusiveClauses.test(type)) { + !GetContext().allowedExclusiveClauses.test(type) && + !GetContext().requiredClauses.test(type)) { context_.Say(GetContext().clauseSource, "%s clause is not allowed on the %s directive"_err_en_US, parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(type).str()), diff --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td --- a/llvm/include/llvm/Frontend/OpenMP/OMP.td +++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td @@ -402,7 +402,6 @@ } def OMP_TargetData : Directive<"target data"> { let allowedClauses = [ - VersionedClause, VersionedClause, VersionedClause ]; @@ -427,8 +426,7 @@ } def OMP_TargetExitData : Directive<"target exit data"> { let allowedClauses = [ - VersionedClause, - VersionedClause + VersionedClause ]; let allowedOnceClauses = [ VersionedClause,