[flang-commits] [flang] [flang][hlfir] address char_convert issues as mentioned in #64315 (PR #67570)

Anthony Cabrera via flang-commits flang-commits at lists.llvm.org
Mon Oct 2 12:48:38 PDT 2023


================
@@ -1435,8 +1450,15 @@ struct UnaryOp<
       // allocate space on the stack for toBuffer
       auto dest = builder.create<fir::AllocaOp>(loc, toTy,
                                                 mlir::ValueRange{bufferSize});
-      builder.create<fir::CharConvertOp>(loc, lhs.getFirBase(), origBufferSize,
-                                         dest);
+      auto src = lhs.getFirBase();
+      if (lhs.getType().isa<hlfir::ExprType>()) {
+        if (auto asExpr = lhs.getDefiningOp<hlfir::AsExprOp>()) {
+          src = asExpr.getVar();
+        }
----------------
cabreraam wrote:

That suggestion did the trick! What do you think?

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


More information about the flang-commits mailing list