[flang-commits] [flang] [Flang][OpenMP] Fix crash and IR errors for user-defined reduction on allocatable variables (PR #186765)

via flang-commits flang-commits at lists.llvm.org
Tue Mar 17 05:02:57 PDT 2026


================
@@ -803,6 +804,185 @@ bool ReductionProcessor::processReductionArguments(
                          &redOperator.u)) {
         if (!ReductionProcessor::supportedIntrinsicProcReduction(
                 *reductionIntrinsic)) {
+          if (isByRef) {
+            // User-defined reduction on allocatable/pointer variable-
+            // we need a new declare_reduction for the boxed type, reusing
+            // the init value and combiner from the existing one. 
+            semantics::Symbol *sym = reductionIntrinsic->v.sym();
+            std::string baseName = sym->name().ToString();
----------------
Ritanya-B-Bharadwaj wrote:

Done!

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


More information about the flang-commits mailing list