]> gcc.gnu.org Git - gcc.git/commit
fortran: Support clobbering of derived types [PR41453]
authorMikael Morin <mikael@gcc.gnu.org>
Thu, 1 Sep 2022 10:35:07 +0000 (12:35 +0200)
committerMikael Morin <mikael@gcc.gnu.org>
Sun, 25 Sep 2022 12:44:54 +0000 (14:44 +0200)
commit77bbf69d2981dafc2ef3e59bfbefb645d88bab9d
tree96df5717abb95282a0c9738559ff0ec04b929d6f
parent95375ffb3dd59f51e79408dd3b2b620dc1af71b1
fortran: Support clobbering of derived types [PR41453]

This adds support for clobbering of non-polymorphic derived type
variables, when they are passed as actual argument whose associated
dummy has the INTENT(OUT) attribute.

We avoid to play with non-constant type sizes or class descriptors by
requiring that the types are derived (not class) and strictly matching,
and by excluding parameterized derived types.

Types that are used in the callee are also excluded: they are types with
allocatable components (the components will be deallocated), and
finalizable types or types with finalizable components (they will be
passed to finalization routines).

PR fortran/41453

gcc/fortran/ChangeLog:

* trans-expr.cc (gfc_conv_procedure_call): Allow strictly
matching derived types.

gcc/testsuite/ChangeLog:

* gfortran.dg/intent_optimize_10.f90: New test.
gcc/fortran/trans-expr.cc
gcc/testsuite/gfortran.dg/intent_optimize_10.f90 [new file with mode: 0644]
This page took 0.059953 seconds and 5 git commands to generate.