Skip to content

Commit 022bd53

Browse files
authored
[flang][runtime][NFC] Add a comment to intrinsic assignment (#153260)
Add a comment explaining why intrinsic derived type assignment unconditionally deallocates all allocated allocatable subobject components of the left-hand side variable, so that I won't forget the reasoning here the next time this comes into question.
1 parent 925db84 commit 022bd53

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flang-rt/lib/runtime/assign.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,9 @@ RT_API_ATTRS int AssignTicket::Begin(WorkQueue &workQueue) {
369369
return status;
370370
}
371371
} else if (!toDerived_->noDestructionNeeded()) {
372+
// F'2023 9.7.3.2 p7: "When an intrinsic assignment statement (10.2.1.3)
373+
// is executed, any noncoarray allocated allocatable subobject of the
374+
// variable is deallocated before the assignment takes place."
372375
if (int status{
373376
workQueue.BeginDestroy(to_, *toDerived_, /*finalize=*/false)};
374377
status != StatOk && status != StatContinue) {

0 commit comments

Comments
 (0)