https://gcc.gnu.org/g:75121d7ab3dd5b270fe2698e10cc98fd21233715
commit 75121d7ab3dd5b270fe2698e10cc98fd21233715 Author: Mikael Morin <[email protected]> Date: Wed Sep 16 15:19:09 2026 +0200 Sauvegarde modifs Diff: --- gcc/fortran/trans-array.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index e0b47ace7bb7..3433cc6c1c8c 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -8658,10 +8658,15 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) tmp2 = build_fold_indirect_ref_loc (input_location, tmp2); dtype = gfc_conv_descriptor_dtype_get (tmp2); } + else if (se->direct_byref + && (se->class_container || se->class_vptr)) + /* If the lhs is polymorphic, take the dtype from the rhs. */ + dtype = gfc_get_dtype (type); else dtype = gfc_get_dtype (parmtype); gfc_conv_descriptor_dtype_set (&loop.pre, parm, dtype); +#if 0 /* 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) @@ -8669,6 +8674,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) tree elen = gfc_conv_descriptor_elem_len_get (desc); gfc_conv_descriptor_elem_len_set(&loop.pre, parm, elen); } +#endif /* The 1st element in the section. */ base = gfc_index_zero_node;
