]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix Coarray in associate not a coarray. [PR110033]
authorAndre Vehreschild <vehre@gcc.gnu.org>
Wed, 24 Jul 2024 07:39:45 +0000 (09:39 +0200)
committerAndre Vehreschild <vehre@gcc.gnu.org>
Thu, 15 Aug 2024 15:24:10 +0000 (17:24 +0200)
commitdbf4c574b92bc692a0380a2b5ee25028321e735f
tree48a83db25994a3e1f33418bf9db1a1a7e6701158
parenta3f1cdd8ed46f9816b31ab162ae4dac547d34ebc
Fix Coarray in associate not a coarray. [PR110033]

A coarray used in an associate did not become a coarray in the block of
the associate.  This patch fixes that and the same also in select type
statements.

PR fortran/110033

gcc/fortran/ChangeLog:

* class.cc (gfc_is_class_scalar_expr): Coarray refs that ref
only self, aka this image, are regarded as scalar, too.
* resolve.cc (resolve_assoc_var): Ignore this image coarray refs
and do not build a new class type.
* trans-expr.cc (gfc_get_caf_token_offset): Get the caf token
from the descriptor for associated variables.
(gfc_conv_variable): Same.
(gfc_trans_pointer_assignment): Assign token to temporary
associate variable, too.
(gfc_trans_scalar_assign): Add flag that assign is for associate
and use it to assign the token.
(is_assoc_assign): Detect that expressions are for associate
assign.
(gfc_trans_assignment_1): Treat associate assigns like pointer
assignments where possible.
* trans-stmt.cc (trans_associate_var): Set same_class only for
class-targets.
* trans.h (gfc_trans_scalar_assign): Add flag to
trans_scalar_assign for marking associate assignments.

gcc/testsuite/ChangeLog:

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