https://gcc.gnu.org/g:364131af03bb4daa6aea753cdd8ace1b48a0e460
commit 364131af03bb4daa6aea753cdd8ace1b48a0e460 Author: Mikael Morin <[email protected]> Date: Thu Oct 16 13:06:50 2025 +0200 Correction régression deferred_character_27.f90 Diff: --- gcc/fortran/trans-array.cc | 8 +++++++- gcc/fortran/trans-descriptor.cc | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 73c2586a3ecf..974eba150f03 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -1025,9 +1025,15 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss, if (eltype && GFC_CLASS_TYPE_P (eltype)) eltype = gfc_get_element_type (TREE_TYPE (TYPE_FIELDS (eltype))); - if (class_expr == NULL_TREE) + if (class_expr == NULL_TREE + && TYPE_SIZE_UNIT (eltype) != NULL_TREE) elemsize = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (eltype)); + else if (class_expr == NULL_TREE) + { + gcc_assert (callee_alloc); + elemsize = NULL_TREE; + } else { /* Unlimited polymorphic entities are initialised with NULL vptr. They diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 2016b360eee7..894c9ff2dace 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -2921,7 +2921,8 @@ gfc_set_temporary_descriptor (stmtblock_t *block, tree descr, tree class_src, ubound[n], stride[n], &offset); } - gfc_conv_descriptor_span_set (block, descr, elemsize); + if (elemsize != NULL_TREE) + gfc_conv_descriptor_span_set (block, descr, elemsize); gfc_conv_descriptor_offset_set (block, descr, offset);
