diff --git a/flang/runtime/allocatable.cpp b/flang/runtime/allocatable.cpp --- a/flang/runtime/allocatable.cpp +++ b/flang/runtime/allocatable.cpp @@ -44,8 +44,9 @@ std::int32_t RTNAME(MoveAlloc)(Descriptor &to, Descriptor &from, bool hasStat, const Descriptor *errMsg, const char *sourceFile, int sourceLine) { Terminator terminator{sourceFile, sourceLine}; - // Should be handled by semantic analysis - RUNTIME_CHECK(terminator, to.type() == from.type()); + // The types must match, unless to is unlimited polymorphic. + RUNTIME_CHECK(terminator, + to.type() == from.type() || to.type().raw() == CFI_type_other); RUNTIME_CHECK(terminator, to.IsAllocatable() && from.IsAllocatable()); // If to and from are the same allocatable they must not be allocated