https://gcc.gnu.org/g:3b38823503eb48c29ae6b1c1b8aad8959d5df71e

commit 3b38823503eb48c29ae6b1c1b8aad8959d5df71e
Author: Mikael Morin <[email protected]>
Date:   Fri Oct 17 15:00:55 2025 +0200

    Correction régression char_length_23.f90

Diff:
---
 gcc/fortran/trans-array.cc      | 1 +
 gcc/fortran/trans-descriptor.cc | 1 +
 2 files changed, 2 insertions(+)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 84020a4b802d..8144cf4a5a60 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -6262,6 +6262,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree 
status, tree errmsg,
 
   if (expr->ts.type == BT_CHARACTER
       && TREE_CODE (se->string_length) == COMPONENT_REF
+      && expr->ts.u.cl->backend_decl
       && expr->ts.u.cl->backend_decl != se->string_length
       && VAR_P (expr->ts.u.cl->backend_decl))
     gfc_add_modify (&se->pre, expr->ts.u.cl->backend_decl,
diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 6ef9fa8145a2..654d72bc867d 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -3329,6 +3329,7 @@ gfc_descriptor_init_count (tree descriptor, int rank, int 
corank,
      it initialized.  */
   if (expr->ts.type == BT_CHARACTER
       && expr->ts.deferred
+      && expr->ts.u.cl->backend_decl
       && VAR_P (expr->ts.u.cl->backend_decl))
     {
       tree dtype;

Reply via email to