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

via flang-commits flang-commits at lists.llvm.org
Tue Oct 3 00:08:51 PDT 2023


================
@@ -1435,8 +1434,10 @@ 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 = hlfir::convertToAddress(loc, builder, lhs,
+                                         lhs.getFortranElementType());
+      builder.create<fir::CharConvertOp>(loc, src.first.getCharBox()->getAddr(),
+                                         origBufferSize, dest);
----------------
jeanPerier wrote:

Please add a call to src.second here if any to insert hlfir.destroy/hlfir.end_associate if some temporary buffer was created for the source. Otherwise looks good.

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


More information about the flang-commits mailing list