Skip to content

Commit 4e93cc9

Browse files
committed
Solved the issue with polymorphic array declaration and where construct
1 parent 6731f15 commit 4e93cc9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ class AssignOpConversion : public mlir::OpRewritePattern<hlfir::AssignOp> {
141141
fir::runtime::genAssignTemporary(builder, loc, toMutableBox, from);
142142
else
143143
fir::runtime::genAssign(builder, loc, toMutableBox, from);
144+
} else if (lhs.isPolymorphic() && rhs.isPolymorphic()) {
145+
if (fir::isNoneOrSeqNone(fir::getElementTypeOf(lhsExv)) &&
146+
fir::isNoneOrSeqNone(fir::getElementTypeOf(rhsExv))) {
147+
mlir::Value to = fir::getBase(builder.createBox(loc, lhsExv));
148+
mlir::Value from = fir::getBase(builder.createBox(loc, rhsExv));
149+
fir::runtime::genAssignPolymorphic(builder, loc, to, from);
150+
}
144151
} else {
145152
// TODO: use the type specification to see if IsFinalizable is set,
146153
// or propagate IsFinalizable attribute from lowering.

0 commit comments

Comments
 (0)