[flang][runtime] Accommodate change of type in assignment to allocatable (#141988)

When an assignment to a derived type allocatable requires
(re)allocation, its type may change to that of the right-hand side. The
code didn't update its derived type pointer, leading to the wrong type
being put into the descriptors created for elemental defined assignment
subroutine calls.

Fixes https://github.com/llvm/llvm-project/issues/141835.
This commit is contained in:
Peter Klausler
2025-06-04 09:22:01 -07:00
committed by GitHub
parent d96447b4d3
commit 7b9518ae27

View File

@@ -330,6 +330,7 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
}
flags &= ~NeedFinalization;
toElementBytes = to.ElementBytes(); // may have changed
toDerived = toAddendum ? toAddendum->derivedType() : nullptr;
}
}
if (toDerived && (flags & CanBeDefinedAssignment)) {