[flang-commits] [flang] [flang] Extend `omp loop` semantic checks for `reduction` (PR #128823)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Thu Feb 27 02:05:38 PST 2025


================
@@ -3118,6 +3118,18 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Reduction &x) {
   if (llvm::omp::nestedReduceWorkshareAllowedSet.test(GetContext().directive)) {
     CheckSharedBindingInOuterContext(objects);
   }
+
+  if (GetContext().directive == llvm::omp::Directive::OMPD_loop) {
+    for (auto clause : GetContext().clauseInfo) {
+      if (const auto *bindClause{
+              std::get_if<parser::OmpClause::Bind>(&clause.second->u)}) {
+        if (bindClause->v.v == parser::OmpBindClause::Binding::Teams) {
+          context_.Say(GetContext().clauseSource,
+              "'REDUCTION' clause not allowed with '!$OMP LOOP BIND(TEAMS)."_err_en_US);
----------------
mjklemm wrote:

```suggestion
              "'REDUCTION' clause not allowed with '!$OMP LOOP BIND(TEAMS)'."_err_en_US);
```

https://github.com/llvm/llvm-project/pull/128823


More information about the flang-commits mailing list