https://gcc.gnu.org/g:7828d9611c58788189f2e1958ce79cec45c3a9a0

commit 7828d9611c58788189f2e1958ce79cec45c3a9a0
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Fri Aug 22 11:31:38 2025 +0200

    Correction régression char_allocation_1

Diff:
---
 gcc/fortran/trans-array.cc | 2 ++
 gcc/fortran/trans-decl.cc  | 7 +++++++
 gcc/fortran/trans.h        | 1 +
 3 files changed, 10 insertions(+)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 4b4a78f73510..46a1f2c5e519 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -6456,6 +6456,8 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree 
* poffset,
   as = IS_CLASS_COARRAY_OR_ARRAY (sym) ? CLASS_DATA (sym)->as : sym->as;
 
   tree eltype = gfc_get_element_type (type);
+  gfc_trans_vla_type_sizes (eltype, NULL_TREE, pblock);
+
   tree elem_len = fold_convert_loc (input_location, gfc_array_index_type,
                                    TYPE_SIZE_UNIT (eltype));
   size = gfc_index_one_node;
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 9d1ed610e2fb..589c6a4715dd 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -4551,6 +4551,13 @@ gfc_trans_vla_type_sizes (gfc_symbol *sym, stmtblock_t 
*body)
       type = TREE_TYPE (TREE_VALUE (current_fake_result_decl));
     }
 
+  return gfc_trans_vla_type_sizes (type, root_decl, body);
+}
+
+
+void
+gfc_trans_vla_type_sizes (tree type, tree root_decl, stmtblock_t *body)
+{
   while (POINTER_TYPE_P (type))
     type = TREE_TYPE (type);
 
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 42060ede54bd..53a75cb76d67 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -605,6 +605,7 @@ tree gfc_get_expr_charlen (gfc_expr *);
 void gfc_conv_string_length (gfc_charlen *, gfc_expr *, stmtblock_t *);
 /* Ensure type sizes can be gimplified.  */
 void gfc_trans_vla_type_sizes (gfc_symbol *, stmtblock_t *);
+void gfc_trans_vla_type_sizes (tree, tree, stmtblock_t *);
 
 /* Add an expression to the end of a block.  */
 void gfc_add_expr_to_block (stmtblock_t *, tree);

Reply via email to