https://gcc.gnu.org/g:786c9c55e97c63c1f83c4c3cffeab693859ab7d7

commit 786c9c55e97c63c1f83c4c3cffeab693859ab7d7
Author: Mikael Morin <[email protected]>
Date:   Wed Oct 15 21:29:50 2025 +0200

    Correction régression associate_47.f90

Diff:
---
 gcc/fortran/trans-array.cc | 15 +++++++--------
 gcc/fortran/trans-types.cc |  3 ++-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index fb0d65c247ba..8ef0ea3cafb0 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8350,14 +8350,13 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
            }
        }
 
-      if (expr->ts.type == BT_CHARACTER
-         && VAR_P (TYPE_SIZE_UNIT (gfc_get_element_type (TREE_TYPE (parm)))))
-       {
-         tree elem_len = TYPE_SIZE_UNIT (gfc_get_element_type (TREE_TYPE 
(parm)));
-         gfc_add_modify (&loop.pre, elem_len,
-                         fold_convert (TREE_TYPE (elem_len),
-                         gfc_get_array_span (desc, expr)));
-       }
+      if (expr->ts.type == BT_CHARACTER)
+       if (tree elt_type = gfc_get_element_type (TREE_TYPE (parm)))
+         if (tree elem_len = TYPE_SIZE_UNIT (elt_type))
+           if (VAR_P (elem_len))
+             gfc_add_modify (&loop.pre, elem_len,
+                             fold_convert (TREE_TYPE (elem_len),
+                             gfc_get_array_span (desc, expr)));
 
       if (info
          && info->ref
diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc
index f9c85bc8ba0f..e3099515a878 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -1401,7 +1401,8 @@ gfc_typenode_for_spec (gfc_typespec * spec, int codim)
       break;
 
     case BT_CHARACTER:
-      basetype = gfc_get_character_type (spec->kind, spec->u.cl);
+      basetype = gfc_get_character_type (spec->kind,
+                                        spec->deferred ? nullptr : spec->u.cl);
       break;
 
     case BT_HOLLERITH:

Reply via email to