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

via flang-commits flang-commits at lists.llvm.org
Mon Aug 17 11:17:47 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:

Confirmed, partial array sections now produce the expected not-yet-implemented diagnostics.

`reduction(myred : a(:))` also reaches that diagnostic, while bare `a` lowers as a whole-array reduction.

Since `a(:)` denotes the whole array, could full-extent sections use the supported HLFIR path? `a` and `a(:)` could serve as positive tests.

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


More information about the flang-commits mailing list