Hi Mikael,

Am 11.07.23 um 12:32 schrieb Mikael Morin via Gcc-patches:
Hello,

this is a followup to Harald's recent work [1] on the evaluation order
of arguments, when one of them is passed to an intent(out) allocatable
dummy and is deallocated before the call.
This extends Harald's fix to support:
  - scalars passed to assumed rank dummies (patch 1),
  - scalars passed to assumed rank dummies with the data reference
  depending on its own content (patch 2),
  - arrays with the data reference depending on its own content
  (patch 3).

There is one (last?) case which is not supported, for which I have opened
a separate PR [2].

Regression tested on x86_64-pc-linux-gnu. OK for master?

this is an impressive improvement for the CLASS case.  Maybe Paul
wants to have another look at it, but it is OK from my side.

Thanks for the patch!

Harald

[1] https://gcc.gnu.org/pipermail/fortran/2023-July/059562.html
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110618

Mikael Morin (3):
   fortran: defer class wrapper initialization after deallocation
     [PR92178]
   fortran: Factor data references for scalar class argument wrapping
     [PR92178]
   fortran: Reorder array argument evaluation parts [PR92178]

  gcc/fortran/trans-array.cc                  |   3 +
  gcc/fortran/trans-expr.cc                   | 130 +++++++++++++++++---
  gcc/fortran/trans.cc                        |  28 +++++
  gcc/fortran/trans.h                         |   8 +-
  gcc/testsuite/gfortran.dg/intent_out_19.f90 |  22 ++++
  gcc/testsuite/gfortran.dg/intent_out_20.f90 |  33 +++++
  gcc/testsuite/gfortran.dg/intent_out_21.f90 |  33 +++++
  7 files changed, 236 insertions(+), 21 deletions(-)
  create mode 100644 gcc/testsuite/gfortran.dg/intent_out_19.f90
  create mode 100644 gcc/testsuite/gfortran.dg/intent_out_20.f90
  create mode 100644 gcc/testsuite/gfortran.dg/intent_out_21.f90


Reply via email to