mlir::ValueRange emptyRange;
mlir::Value s = createShape(loc, exv);
return create<fir::EmboxOp>(loc, boxTy, itemAddr, s, /*slice=*/empty,
- /*typeparams=*/emptyRange, box.getTdesc());
+ /*typeparams=*/emptyRange,
+ isPolymorphic ? box.getTdesc() : tdesc);
},
[&](const fir::CharArrayBoxValue &box) -> mlir::Value {
mlir::Value s = createShape(loc, exv);
mlir::Value empty;
mlir::ValueRange emptyRange;
return create<fir::EmboxOp>(loc, boxTy, itemAddr, empty, empty,
- emptyRange, p.getTdesc());
+ emptyRange,
+ isPolymorphic ? p.getTdesc() : tdesc);
},
[&](const auto &) -> mlir::Value {
mlir::Value empty;
! CHECK: }
! CHECK: fir.array_merge_store %{{.*}}, %{{.*}} to %{{.*}}[%{{.*}}] : !fir.array<?xi32>, !fir.array<?xi32>, !fir.class<!fir.heap<!fir.array<?x!fir.type<_QMpolymorphic_testTp1{a:i32,b:i32}>>>>, !fir.slice<1>
+ subroutine polymorphic_to_nonpolymorphic(p)
+ class(p1), pointer :: p(:)
+ type(p1), allocatable, target :: t(:)
+ t = p
+ end subroutine
+
+! CHECK-LABEL: func.func @_QMpolymorphic_testPpolymorphic_to_nonpolymorphic
+! Just checking that FIR is generated without error.
+
end module