[flang-commits] [flang] [flang] Fixed repacking for TARGET and INTENT(OUT) (PR #131972)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed Mar 19 03:51:39 PDT 2025
================
@@ -346,6 +347,8 @@ The copy creation is also restricted for `ASYNCHRONOUS` and `VOLATILE` arguments
It does not make sense to generate the new operations for `CONTIGUOUS` arguments and for arguments with statically known element size that exceeds the `max-element-size` threshold.
+The `fir.pack_array`'s copy-in action cannot be skipped for `INTENT(OUT)` dummy argument of a derived type that requires finalization on entry to the subprogram, as long as the finalization subroutines may access the value of the dummy argument. In this case `fir.pack_array` operation cannot have `no_copy` attribute, so that it creates a contiguous temporary matching the value of the original array, and then the temporary is finalized before execution of the subprogram's body begins.
----------------
tblah wrote:
Why not keep `no_copy` but still finalize before `fir.pack_array`?
https://github.com/llvm/llvm-project/pull/131972
More information about the flang-commits
mailing list