]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: Pass pre-calculated class container argument [pr110618]
authorMikael Morin <mikael@gcc.gnu.org>
Mon, 17 Jul 2023 12:14:22 +0000 (14:14 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Mon, 17 Jul 2023 12:14:22 +0000 (14:14 +0200)
commite21e13e2525a042a0aabfbcb4ebf4f08609078c7
tree9a23f6dcc8ca07ebc64f76b561d55a9417ec6e74
parent1a46400e5ac0f21eead74b10752f69ebc7a8be27
fortran: Pass pre-calculated class container argument [pr110618]

Pass already evaluated class container argument from
gfc_conv_procedure_call down to gfc_add_finalizer_call through
gfc_deallocate_scalar_with_status and gfc_deallocate_with_status,
to avoid repeatedly evaluating the same data reference expressions
in the generated code.

PR fortran/110618

gcc/fortran/ChangeLog:

* trans.h (gfc_deallocate_with_status): Add class container
argument.
(gfc_deallocate_scalar_with_status): Ditto.
* trans.cc (gfc_deallocate_with_status): Add class container
argument and pass it down to gfc_add_finalize_call.
(gfc_deallocate_scalar_with_status): Same.
* trans-array.cc (structure_alloc_comps): Update caller.
* trans-stmt.cc (gfc_trans_deallocate): Ditto.
* trans-expr.cc (gfc_conv_procedure_call): Ditto.  Pass
pre-evaluated class container argument if it's available.

gcc/testsuite/ChangeLog:

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