Skip to content

Commit 62afaae

Browse files
klauslerrorth
authored andcommitted
[flang][runtime] Accommodate change of type in assignment to allocatable (llvm#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 llvm#141835.
1 parent d8c0010 commit 62afaae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

flang-rt/lib/runtime/assign.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
330330
}
331331
flags &= ~NeedFinalization;
332332
toElementBytes = to.ElementBytes(); // may have changed
333+
toDerived = toAddendum ? toAddendum->derivedType() : nullptr;
333334
}
334335
}
335336
if (toDerived && (flags & CanBeDefinedAssignment)) {

0 commit comments

Comments
 (0)