[flang-commits] [flang] [flang] Allow non-index length parameter on exprs fed into hlfir.get_length. (PR #124827)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Jan 28 12:10:21 PST 2025


================
@@ -359,6 +359,7 @@ struct GetLengthOpConversion
     fir::FirOpBuilder builder(rewriter, getLength.getOperation());
     hlfir::Entity bufferizedExpr = getBufferizedExprStorage(adaptor.getExpr());
     mlir::Value length = hlfir::genCharLength(loc, builder, bufferizedExpr);
+    length = builder.createConvert(loc, builder.getIndexType(), length);
     if (!length)
----------------
tblah wrote:

I think you need to move the change to after the `if`. Otherwise it will try to use the empty value when building the convert.

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


More information about the flang-commits mailing list