Skip to content

Commit 735c474

Browse files
committed
review comments
1 parent bf2d407 commit 735c474

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,6 +1481,7 @@ class ScalarExprLowering {
14811481
delta = builder.create<mlir::MulIOp>(loc, delta, ext);
14821482
++dim;
14831483
}
1484+
auto origRefTy = refTy;
14841485
if (fir::factory::CharacterExprHelper::isCharacterScalar(refTy)) {
14851486
auto chTy = fir::factory::CharacterExprHelper::getCharacterType(refTy);
14861487
if (fir::characterWithDynamicLen(chTy)) {
@@ -1492,8 +1493,10 @@ class ScalarExprLowering {
14921493
base = builder.createConvert(loc, seqRefTy, base);
14931494
}
14941495
}
1495-
return builder.create<fir::CoordinateOp>(
1496+
auto coor = builder.create<fir::CoordinateOp>(
14961497
loc, refTy, base, llvm::ArrayRef<mlir::Value>{total});
1498+
// Convert to expected, original type after address arithmetic.
1499+
return builder.createConvert(loc, origRefTy, coor);
14971500
};
14981501
return array.match(
14991502
[&](const fir::ArrayBoxValue &arr) -> ExtValue {

0 commit comments

Comments
 (0)