https://gcc.gnu.org/g:37fd317c3c4b599e26d26a63b1a748da96708a69
commit 37fd317c3c4b599e26d26a63b1a748da96708a69 Author: Mikael Morin <[email protected]> Date: Wed Oct 14 11:33:25 2026 +0200 Réduction appels is_subref_array Diff: --- gcc/fortran/trans-expr.cc | 7 +++++-- gcc/fortran/trans-stmt.cc | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 55c4e326b771..70e41a49dd99 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -2294,8 +2294,11 @@ gfc_get_expr_charlen (gfc_expr *e) length = NULL; /* To silence compiler warning. */ - if (is_subref_array (e) && e->ts.u.cl->length) + if (e->ts.u.cl->length) { + if (e->ts.u.cl->backend_decl) + return e->ts.u.cl->backend_decl; + gfc_se tmpse; gfc_init_se (&tmpse, NULL); gfc_conv_expr_type (&tmpse, e->ts.u.cl->length, gfc_charlen_type_node); @@ -7094,7 +7097,7 @@ conv_null_actual (gfc_se * parmse, gfc_expr * e, gfc_symbol * fsym) /* Return true if a subobject of the elements of an array is referenced. */ -static bool +bool is_subobject_ref (gfc_expr *e) { bool seen_array = false; diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 2a87176ffa9f..5821f0935858 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -2057,7 +2057,7 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) /* PDT array and string components are separately allocated for each element of a PDT array. Therefore, there is no choice but to copy in and copy out the target expression. */ - else if (e && is_subref_array (e) + else if (e && is_subobject_ref (e) && (gfc_expr_attr (e).pdt_array || gfc_expr_attr (e).pdt_string)) { gfc_se init; @@ -6732,7 +6732,7 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate) substring references, part-refs, or %re/%im inquiries, wrap the entity in parentheses to force evaluation of the expression. */ if (code->expr3->expr_type == EXPR_VARIABLE - && is_subref_array (code->expr3)) + && is_subobject_ref (code->expr3)) code->expr3 = gfc_get_parentheses (code->expr3); if (code->expr3->expr_type == EXPR_VARIABLE
