[flang-commits] [flang] [flang][OpenMP] Diagnose task reduction array sections and elements (PR #215997)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Aug 25 04:17:07 PDT 2026


================
@@ -182,6 +180,124 @@ static bool hasPrivatizedArrayElementReduction(
   return false;
 }
 
+static bool
+hasPartialArrayReductionObject(llvm::ArrayRef<Object> reductionObjects,
+                               semantics::SemanticsContext &semaCtx) {
+  for (const Object &object : reductionObjects) {
+    if (!object.ref() || isWholeArraySection(object, semaCtx))
+      continue;
+    if (evaluate::IsArraySection(*object.ref()))
+      return true;
+  }
+  return false;
+}
+
+static void checkTaskModifierPartialArrayReduction(
+    mlir::Location loc, semantics::SemanticsContext &semaCtx,
+    mlir::omp::ReductionModifierAttr reductionMod,
+    llvm::ArrayRef<Object> reductionObjects) {
+  if (reductionMod &&
----------------
tblah wrote:

I did this on purpose. The MLIR representation only stores one modifier. This is incorrect but I didn't want to expand the scope of this PR further to include modifying the MLIR dialect or diagnosing a completely unrelated latent bug.

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


More information about the flang-commits mailing list