[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Suppression appel build_class_array_ref
Mikael Morin
mikael@gcc.gnu.org
Wed Sep 17 13:47:38 GMT 2025
https://gcc.gnu.org/g:8a768ab3550297366f2eaaa90d2936d2a2280209
commit 8a768ab3550297366f2eaaa90d2936d2a2280209
Author: Mikael Morin <mikael@gcc.gnu.org>
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 d044df159db6..44812c26e24f 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3609,82 +3609,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. */
@@ -3753,10 +3677,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);
More information about the Gcc-cvs
mailing list