[flang-commits] [flang] [FLANG] Solving issue with adjustr intrinsic in where construct (PR #146851)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon Aug 18 11:54:22 PDT 2025


================
@@ -445,8 +445,16 @@ struct AssociateOpConversion
              !mlir::isa<fir::BaseBoxType>(assocType)) ||
             ((mlir::isa<fir::BoxCharType>(sourceVar.getType()) &&
               !mlir::isa<fir::BoxCharType>(assocType)))) {
-          sourceVar =
-              fir::BoxAddrOp::create(builder, loc, assocType, sourceVar);
+          sourceVar = builder.create<fir::BoxAddrOp>(loc, assocType, sourceVar);
+        } else if (mlir::isa<fir::ReferenceType>(sourceVar.getType()) &&
+                   mlir::isa<fir::BoxCharType>(assocType)) {
+          mlir::Value lenVal = associate.getTypeparams()[0];
+          auto refTy = mlir::cast<fir::ReferenceType>(sourceVar.getType());
+          auto charTy = mlir::dyn_cast<fir::CharacterType>(refTy.getEleTy());
----------------
vzakhari wrote:

```suggestion
          auto charTy = mlir::cast<fir::CharacterType>(refTy.getEleTy());
```

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


More information about the flang-commits mailing list