summaryrefslogtreecommitdiff
path: root/flang
diff options
context:
space:
mode:
Diffstat (limited to 'flang')
-rw-r--r--flang/runtime/assign.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/flang/runtime/assign.cpp b/flang/runtime/assign.cpp
index 9e10e2f491ed..f75fe94bf300 100644
--- a/flang/runtime/assign.cpp
+++ b/flang/runtime/assign.cpp
@@ -294,6 +294,10 @@ static void Assign(
StaticDescriptor<maxRank, true, 16> staticDesc;
Descriptor &newFrom{staticDesc.descriptor()};
std::memcpy(&newFrom, &from, descBytes);
+ // Pretend the temporary descriptor is for an ALLOCATABLE
+ // entity, otherwise, the Deallocate() below will not
+ // free the descriptor memory.
+ newFrom.raw().attribute = CFI_attribute_allocatable;
auto stat{ReturnError(terminator, newFrom.Allocate())};
if (stat == StatOk) {
char *toAt{newFrom.OffsetElement()};