[flang] Allow `to` argument of move_alloc to be class(*)
authorDavid Truby <David.Truby@arm.com>
Tue, 28 Feb 2023 14:32:37 +0000 (14:32 +0000)
committerDavid Truby <david.truby@arm.com>
Tue, 28 Feb 2023 14:32:59 +0000 (14:32 +0000)
This patch expands the runtime check in move_alloc to allow the
destination to be unlimited polymorphic.

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D143571

flang/runtime/allocatable.cpp

index 6f066ea..b428ee6 100644 (file)
@@ -44,9 +44,6 @@ void RTNAME(AllocatableInitDerived)(Descriptor &descriptor,
 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());
-  RUNTIME_CHECK(terminator, to.IsAllocatable() && from.IsAllocatable());
 
   // If to and from are the same allocatable they must not be allocated
   // and nothing should be done.