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

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Mon Mar 16 06:30:10 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();
----------------
eugeneepshteyn wrote:

I'm pretty sure you don't need a full fledged `std::string` here. Please check if `lookupSymbol` takes something like `llvm::StringRef`

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


More information about the flang-commits mailing list