[J3] Another thought on paper 24-142r2 (ASYNCHRONOUS issue)
Daniel C Chen
cdchen at ca.ibm.com
Wed Jun 26 11:07:34 UTC 2024
Thanks for all the explanations from everyone!
If I understand correctly, the rational of disallowing an <expr> actual argument (effective actual argument would be a temp) or in this case an array section with vector subscripts (effective actual argument would also be a temp) corresponding to a dummy argument with the ASYNCHRONOUS attribute is to prevent the temp being destroyed after the subroutine returns while the asynchronous I/O is not done yet.
By the same reason, would the following code have the same issue and be invalid?
"
program main
interface
subroutine asynch_write()
end subroutine
end interface
call asynch_write()
end
subroutine asynch_write()
integer :: local_1(3), local_2(3)
OPEN(ASYNCHRONOUS='yes', UNIT=4, FORM='unformatted')
WRITE(ASYNCHRONOUS='yes', UNIT=4) local_1 + local_2
end subroutine
"
Please note that I intentionally made the <output-item> an <expr> as it is what it is in the standard (i.e. not a variable, thus not definable).
"R1217 output-item is <expr>
or io-implied-do"
Without a WAIT statement at the end of the subroutine, the <output-item> expression could also be destroyed before the asynchronous I/O finishes.
I can't see the difference between these two cases. Am I missing something simple here?
Any comments are highly appreciated.
Thanks,
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20240626/bb8e22c4/attachment.htm>
More information about the J3
mailing list