[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression strarray_4
Mikael Morin
mikael@gcc.gnu.org
Fri Jun 13 15:00:14 GMT 2025
https://gcc.gnu.org/g:b935e3cf5550d1c8a0ef2a05b3f4505c9ea447e4
commit b935e3cf5550d1c8a0ef2a05b3f4505c9ea447e4
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Wed Apr 30 12:07:30 2025 +0200
Correction régression strarray_4
Diff:
---
gcc/fortran/trans-array.cc | 2 ++
gcc/fortran/trans-decl.cc | 17 ++++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 84df0caacedc..563b8e35607a 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -6162,6 +6162,8 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset,
int dim;
+ gfc_trans_vla_type_sizes (sym, pblock);
+
as = IS_CLASS_COARRAY_OR_ARRAY (sym) ? CLASS_DATA (sym)->as : sym->as;
tree eltype = gfc_get_element_type (type);
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index c3982a10e649..5807818a3ae6 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -4385,6 +4385,21 @@ gfc_trans_assign_aux_var (gfc_symbol * sym, gfc_wrapped_block * block)
gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE);
}
+
+static bool
+decl_ref_or_const_like_p (tree t)
+{
+ if (TREE_CONSTANT (t) || DECL_P (t))
+ return true;
+
+ if (TREE_CODE (t) == SAVE_EXPR
+ || TREE_CODE (t) == NON_LVALUE_EXPR)
+ return decl_ref_or_const_like_p (TREE_OPERAND (t, 0));
+ else
+ return false;
+}
+
+
static void
gfc_trans_vla_one_sizepos (tree *tp, tree root_decl, stmtblock_t *body)
{
@@ -4392,7 +4407,7 @@ gfc_trans_vla_one_sizepos (tree *tp, tree root_decl, stmtblock_t *body)
if (t == NULL || t == error_mark_node)
return;
- if (TREE_CONSTANT (t) || DECL_P (t))
+ if (decl_ref_or_const_like_p (t))
return;
if (contains_placeholder_p (t))
More information about the Gcc-cvs
mailing list