https://gcc.gnu.org/g:6ba496df0b27b84f7080726e57bfaaec54ce9e01
commit 6ba496df0b27b84f7080726e57bfaaec54ce9e01 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Tue Feb 4 15:58:37 2025 +0100 Correction régression allocate_with_mold_3 Diff: --- gcc/fortran/trans-array.cc | 7 +++++++ gcc/fortran/trans-types.cc | 3 +++ 2 files changed, 10 insertions(+) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 9ea0f255a3ef..cfc9ab95d863 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -807,6 +807,13 @@ scalar_value::get_length (gfc_typespec * type_info) const tree size; if (use_tree_type ()) { + if (TREE_CODE (value) == COMPONENT_REF) + { + tree parent_obj = TREE_OPERAND (value, 0); + if (GFC_CLASS_TYPE_P (TREE_TYPE (parent_obj))) + return gfc_class_len_get (parent_obj); + } + tree etype = get_elt_type (); gfc_get_type_info (etype, &n, &size); } diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc index 5f8100b9d45e..83d35236c19d 100644 --- a/gcc/fortran/trans-types.cc +++ b/gcc/fortran/trans-types.cc @@ -1742,6 +1742,9 @@ gfc_get_type_info (tree etype, bt *type, tree *psize) if (type) *type = n; + if (psize == nullptr) + return; + switch (n) { case BT_CHARACTER: