https://gcc.gnu.org/g:ae46f2182ce06e74d56c48291cadc89b5407afcc
commit ae46f2182ce06e74d56c48291cadc89b5407afcc Author: Mikael Morin <[email protected]> Date: Wed Sep 16 14:55:54 2026 +0200 Sauvegarde modifs Diff: --- gcc/fortran/trans-array.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index abc606dc627f..e0b47ace7bb7 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -8662,6 +8662,14 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) dtype = gfc_get_dtype (parmtype); gfc_conv_descriptor_dtype_set (&loop.pre, parm, dtype); + /* The element length has just been set from the declaration type. + Overwrite it with the runtime value for classes. */ + if (expr->ts.type == BT_CLASS) + { + tree elen = gfc_conv_descriptor_elem_len_get (desc); + gfc_conv_descriptor_elem_len_set(&loop.pre, parm, elen); + } + /* The 1st element in the section. */ base = gfc_index_zero_node; if (expr->ts.type == BT_CHARACTER && expr->rank == 0 && codim)
