]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: defer class wrapper initialization after deallocation [PR92178]
authorMikael Morin <mikael@gcc.gnu.org>
Fri, 14 Jul 2023 12:15:07 +0000 (14:15 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Fri, 14 Jul 2023 12:15:07 +0000 (14:15 +0200)
commite93452a5712e87ba624562ba7164b1e1394d18fb
treef6e29e091a8a91fe29b82b373937a61936113724
parenta85a106c35c6d1d9fd40627e149501e5e854bcc3
fortran: defer class wrapper initialization after deallocation [PR92178]

If an actual argument is associated with an INTENT(OUT) dummy, and code
to deallocate it is generated, generate the class wrapper initialization
after the actual argument deallocation.

This is achieved by passing a cleaned up expression to
gfc_conv_class_to_class, so that the class wrapper initialization code
can be isolated and moved independently after the deallocation.

PR fortran/92178

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Use a separate gfc_se
struct, initalized from parmse, to generate the class wrapper.
After the class wrapper code has been generated, copy it back
depending on whether parameter deallocation code has been
generated.

gcc/testsuite/ChangeLog:

* gfortran.dg/intent_out_19.f90: New test.
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/intent_out_19.f90 [new file with mode: 0644]