There are several observations regarding the copy-in/copy-out:
- Actual argument associated with INTENT(OUT) dummy argument that requires finalization (7.5.6.3 p. 7) may be read by the finalization function, so a copy-in is required.
- A temporary created for the copy-in/copy-out must be destroyed without finalization after the call (or after the corresponding copy-out), otherwise, memory leaks may occur.
- The copy-out assignment must not perform finalization for the LHS.
- The copy-out assignment from the temporary to the actual argument may or may not need to initialize the LHS.
This change-set introduces new runtime methods: CopyOutAssign and
DestroyWithoutFinalization. They are called by the compiler generated
code to match the behavior described above.