https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86468
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Andre Vehreschild <ve...@gcc.gnu.org>: https://gcc.gnu.org/g:723b30bee4e4fa3feba9ef03ce7dca95501e1555 commit r15-3066-g723b30bee4e4fa3feba9ef03ce7dca95501e1555 Author: Andre Vehreschild <ve...@gcc.gnu.org> Date: Fri Aug 16 15:07:39 2024 +0200 Fix coarray rank for non-coarrays in derived types. [PR86468] The corank was propagated to array components in derived types. Fix this by setting a zero corank when the array component is not a pointer. For pointer typed array components propagate the corank of the derived type to allow associating the component to a coarray. gcc/fortran/ChangeLog: PR fortran/86468 * trans-intrinsic.cc (conv_intrinsic_move_alloc): Correct comment. * trans-types.cc (gfc_sym_type): Pass coarray rank, not false. (gfc_get_derived_type): Only propagate codimension for coarrays and pointers to array components in derived typed coarrays. gcc/testsuite/ChangeLog: * gfortran.dg/coarray_lib_this_image_2.f90: Fix array rank in tree dump scan. * gfortran.dg/coarray_lib_token_4.f90: Same. * gfortran.dg/coarray/move_alloc_2.f90: New test.