]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: fix TRANSFER of subarray component references [PR122386]
authorHarald Anlauf <anlauf@gmx.de>
Thu, 23 Oct 2025 19:21:04 +0000 (21:21 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Fri, 24 Oct 2025 17:07:45 +0000 (19:07 +0200)
commit2febf3b968329aceeeea7805af98ed98a8c67e75
treecca16827ec82a0db21cc8080f6b183538bbb02ba
parente7ac1359e46df57a810ca8b0478d3b5176b1b8f5
Fortran: fix TRANSFER of subarray component references [PR122386]

Commit r16-518 introduced a change that fixed inquiry references of complex
arrays as argument to the TRANSFER intrinsic by forcing a temporary.  The
solution taken however turned out not to be generalizable to component
references of nested derived-type arrays.  A better way is the revert that
patch and force the generation of a temporary when the SOURCE expression is
a not simply-contiguous array.

PR fortran/122386

gcc/fortran/ChangeLog:

* dependency.cc (gfc_ref_needs_temporary_p): Revert r16-518.
* trans-intrinsic.cc (gfc_conv_intrinsic_transfer): Force temporary
for SOURCE not being a simply-contiguous array.

gcc/testsuite/ChangeLog:

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