summaryrefslogtreecommitdiff
path: root/flang-rt/lib/runtime/assign.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang-rt/lib/runtime/assign.cpp')
-rw-r--r--flang-rt/lib/runtime/assign.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/flang-rt/lib/runtime/assign.cpp b/flang-rt/lib/runtime/assign.cpp
index 7cf4147a94a9..6aeb10320878 100644
--- a/flang-rt/lib/runtime/assign.cpp
+++ b/flang-rt/lib/runtime/assign.cpp
@@ -369,6 +369,9 @@ RT_API_ATTRS int AssignTicket::Begin(WorkQueue &workQueue) {
return status;
}
} else if (!toDerived_->noDestructionNeeded()) {
+ // F'2023 9.7.3.2 p7: "When an intrinsic assignment statement (10.2.1.3)
+ // is executed, any noncoarray allocated allocatable subobject of the
+ // variable is deallocated before the assignment takes place."
if (int status{
workQueue.BeginDestroy(to_, *toDerived_, /*finalize=*/false)};
status != StatOk && status != StatContinue) {