https://gcc.gnu.org/g:0d6f58c63178f7166aa5e5ef48fd2c4a0a35eb7e
commit 0d6f58c63178f7166aa5e5ef48fd2c4a0a35eb7e Author: Mikael Morin <mik...@gcc.gnu.org> Date: Tue Feb 4 17:42:38 2025 +0100 Correction coarray_allocate_8.f08 Diff: --- gcc/fortran/trans-array.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 6f582d34e53e..f3322af9157c 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -923,7 +923,10 @@ get_descriptor_init (tree type, gfc_typespec *ts, int rank, after leaving the scope. It may still be accessed through another image. This may happen, for example, with the caf_mpi implementation. */ - tree token_field = gfc_advance_chain (fields, CAF_TOKEN_FIELD); + bool dim_present = GFC_TYPE_ARRAY_RANK (type) > 0 + || GFC_TYPE_ARRAY_CORANK (type) > 0; + tree token_field = gfc_advance_chain (fields, + CAF_TOKEN_FIELD - (!dim_present)); tree token_value = fold_convert (TREE_TYPE (token_field), null_pointer_node); CONSTRUCTOR_APPEND_ELT (v, token_field, token_value);