https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92178
--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Mikael Morin <mik...@gcc.gnu.org>: https://gcc.gnu.org/g:e93452a5712e87ba624562ba7164b1e1394d18fb commit r14-2519-ge93452a5712e87ba624562ba7164b1e1394d18fb Author: Mikael Morin <mik...@gcc.gnu.org> Date: Fri Jul 14 14:15:07 2023 +0200 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.