https://gcc.gnu.org/g:2dd5a0be26a0212854a0501201766a235ef7d18a
commit 2dd5a0be26a0212854a0501201766a235ef7d18a Author: Mikael Morin <[email protected]> Date: Wed Sep 17 11:36:58 2025 +0200 Suppression appel build_class_array_ref Diff: --- gcc/fortran/trans-array.cc | 80 ---------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 4ed133af0de0..2a63796a9f24 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -3644,82 +3644,6 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i, } -/* Build a scalarized array reference using the vptr 'size'. */ - -static bool -build_class_array_ref (gfc_se *se, tree base, tree index) -{ - tree size; - tree decl = NULL_TREE; - tree tmp; - gfc_expr *expr = se->ss->info->expr; - gfc_expr *class_expr; - gfc_typespec *ts; - gfc_symbol *sym; - - tmp = !VAR_P (base) ? gfc_get_class_from_expr (base) : NULL_TREE; - - if (tmp != NULL_TREE) - decl = tmp; - else - { - /* The base expression does not contain a class component, either - because it is a temporary array or array descriptor. Class - array functions are correctly resolved above. */ - if (!expr - || (expr->ts.type != BT_CLASS - && !gfc_is_class_array_ref (expr, NULL))) - return false; - - /* Obtain the expression for the class entity or component that is - followed by an array reference, which is not an element, so that - the span of the array can be obtained. */ - class_expr = gfc_find_and_cut_at_last_class_ref (expr, false, &ts); - - if (!ts) - return false; - - sym = (!class_expr && expr) ? expr->symtree->n.sym : NULL; - if (sym && sym->attr.function - && sym == sym->result - && sym->backend_decl == current_function_decl) - /* The temporary is the data field of the class data component - of the current function. */ - decl = gfc_get_fake_result_decl (sym, 0); - else if (sym) - { - if (decl == NULL_TREE) - decl = expr->symtree->n.sym->backend_decl; - /* For class arrays the tree containing the class is stored in - GFC_DECL_SAVED_DESCRIPTOR of the sym's backend_decl. - For all others it's sym's backend_decl directly. */ - if (DECL_LANG_SPECIFIC (decl) && GFC_DECL_SAVED_DESCRIPTOR (decl)) - decl = GFC_DECL_SAVED_DESCRIPTOR (decl); - } - else - decl = gfc_get_class_from_gfc_expr (class_expr); - - if (POINTER_TYPE_P (TREE_TYPE (decl))) - decl = build_fold_indirect_ref_loc (input_location, decl); - - if (!GFC_CLASS_TYPE_P (TREE_TYPE (decl))) - return false; - } - - se->class_vptr = gfc_evaluate_now (gfc_class_vptr_get (decl), &se->pre); - - size = gfc_class_vtab_size_get (decl); - /* For unlimited polymorphic entities then _len component needs to be - multiplied with the size. */ - size = gfc_resize_class_size_with_len (&se->pre, decl, size); - size = fold_convert (TREE_TYPE (index), size); - - /* Return the element in the se expression. */ - se->expr = gfc_build_spanned_array_ref (base, index, size); - return true; -} - - /* Indicates that the tree EXPR is a reference to an array that can’t have any negative stride. */ @@ -3787,10 +3711,6 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar, base = build_fold_indirect_ref_loc (input_location, info->current_elem.base); - /* Use the vptr 'size' field to access the element of a class array. */ - if (build_class_array_ref (se, base, index)) - return; - if (get_CFI_desc (NULL, expr, &decl, ar)) decl = build_fold_indirect_ref_loc (input_location, decl);
