[flang-commits] [flang] [Flang][OpenMP] Fix crash with character types in declare_reduction (PR #178038)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed Jan 28 05:51:56 PST 2026


================
@@ -3767,9 +3767,19 @@ static ReductionProcessor::GenCombinerCBTy processReductionCombiner(
       fir::FortranVariableFlagsAttr attributes =
           Fortran::lower::translateSymbolAttributes(builder.getContext(),
                                                     *object.sym(), extraFlags);
+      // For character types, we need to provide the length parameter
+      llvm::SmallVector<mlir::Value> typeParams;
+      mlir::Type unwrappedType = fir::unwrapRefType(type);
+      if (auto charTy = mlir::dyn_cast<fir::CharacterType>(unwrappedType)) {
+        if (charTy.hasConstantLen()) {
----------------
tblah wrote:

oh wait sorry I missed this, which can also use hlfir::genLengthParameters

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


More information about the flang-commits mailing list