[flang-commits] [flang] [FLANG][OMP] Add error message for invalid dependence type in taskwait construct (#219234). (PR #220837)

via flang-commits flang-commits at lists.llvm.org
Thu Sep 3 11:50:43 PDT 2026


https://github.com/laoshd updated https://github.com/llvm/llvm-project/pull/220837

>From 9b342c5102a628f551ab2acc2314cea0ccc08558 Mon Sep 17 00:00:00 2001
From: Shandong Lao <shandong.lao at hpe.com>
Date: Thu, 3 Sep 2026 02:59:54 -0500
Subject: [PATCH 1/2] [FLANG][OMP] #219234: Add error message for invalid
 dependence type in taskwait construct.

---
 flang/lib/Semantics/check-omp-structure.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 274efa64d03d0..762c9bf8a9be7 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -5116,6 +5116,14 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Depend &x) {
       context_.Say(GetContext().clauseSource,
           "The SINK and SOURCE dependence types can only be used with the ORDERED directive, used here in the %s construct"_err_en_US,
           parser::omp::GetUpperName(dir, version));
+    } else if (dir == llvm::omp::OMPD_taskwait &&
+        taskDep->GetTaskDepType() ==
+            parser::OmpTaskDependenceType::Value::Mutexinoutset) {
+      // A depend clause on a taskwait construct must not have
+      // mutexinoutset as dependence-type.
+      context_.Say(GetContext().clauseSource,
+          "A DEPEND clause on a TASKWAIT construct must not have %s as dependence type"_err_en_US,
+          "MUTEXINOUTSET");
     }
   }
   if (taskDep) {

>From 82e1a9ac034275c7f5dd4fd2b6b62a02d0cf0579 Mon Sep 17 00:00:00 2001
From: Shandong Lao <shandong.lao at hpe.com>
Date: Thu, 3 Sep 2026 12:55:07 -0500
Subject: [PATCH 2/2] [FLANG][OMP] #219234: Improve error message for TASKWAIT
 depend clause and add tests

---
 flang/lib/Semantics/check-omp-structure.cpp       | 3 +--
 flang/test/Semantics/OpenMP/clause-validity01.f90 | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 762c9bf8a9be7..05694bdad9f95 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -5122,8 +5122,7 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Depend &x) {
       // A depend clause on a taskwait construct must not have
       // mutexinoutset as dependence-type.
       context_.Say(GetContext().clauseSource,
-          "A DEPEND clause on a TASKWAIT construct must not have %s as dependence type"_err_en_US,
-          "MUTEXINOUTSET");
+          "A DEPEND clause on a TASKWAIT construct must not have MUTEXINOUTSET as dependence type"_err_en_US);
     }
   }
   if (taskDep) {
diff --git a/flang/test/Semantics/OpenMP/clause-validity01.f90 b/flang/test/Semantics/OpenMP/clause-validity01.f90
index 773fd82aaeb43..c9df70b4eaeb7 100644
--- a/flang/test/Semantics/OpenMP/clause-validity01.f90
+++ b/flang/test/Semantics/OpenMP/clause-validity01.f90
@@ -504,6 +504,8 @@
   !$omp taskyield
   !$omp barrier
   !$omp taskwait
+  !ERROR: A DEPEND clause on a TASKWAIT construct must not have MUTEXINOUTSET as dependence type
+  !$omp taskwait depend(mutexinoutset: x)
   !WARNING: SOURCE dependence type is deprecated in OpenMP v5.2
   !ERROR: The SINK and SOURCE dependence types can only be used with the ORDERED directive, used here in the TASKWAIT construct
   !$omp taskwait depend(source)



More information about the flang-commits mailing list