[flang-commits] [flang] [flang][OpenMP] Diagnose privatized array section reductions (PR #215997)

via flang-commits flang-commits at lists.llvm.org
Wed Aug 19 10:06:17 PDT 2026


================
@@ -4922,14 +4919,16 @@ static mlir::omp::TaskloopContextOp genStandaloneTaskloop(
                            enableDelayedPrivatization, symTable);
   dsp.processStep1(&taskloopClauseOps);
 
-  if (hasPrivatizedArrayElementReduction(inReductionObjects,
-                                         dsp.getAllSymbolsToPrivatize()))
-    TODO(loc, "TASKLOOP construct with IN_REDUCTION of an array element whose "
-              "base array is privatized");
-  if (hasPrivatizedArrayElementReduction(reductionObjects,
-                                         dsp.getAllSymbolsToPrivatize()))
-    TODO(loc, "TASKLOOP construct with REDUCTION of an array element whose "
-              "base array is privatized");
+  if (hasPrivatizedArrayReductionObject(inReductionObjects,
+                                        dsp.getDelayedPrivSymbols()))
+    TODO(loc,
+         "TASKLOOP construct with IN_REDUCTION of an array element or section "
+         "whose base array is privatized");
+  if (hasPrivatizedArrayReductionObject(reductionObjects,
+                                        dsp.getDelayedPrivSymbols()))
----------------
MattPD wrote:

Thanks for clarifying. With both commits applied, the full-extent section `a(:)` now behaves correctly under default data-sharing attributes. The partial section `a(2:3)` with an explicitly `shared` base still produces a four-element reduction in both modes: eager and delayed. Could you check the partial-section handling?

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


More information about the flang-commits mailing list