[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Refactoring calcul stride
Mikael Morin
mikael@gcc.gnu.org
Wed Sep 17 15:48:36 GMT 2025
https://gcc.gnu.org/g:971fd2741d14ecf5a5c13260f2b25161f00df803
commit 971fd2741d14ecf5a5c13260f2b25161f00df803
Author: Mikael Morin <mikael@gcc.gnu.org>
Date: Tue Sep 16 21:59:37 2025 +0200
Refactoring calcul stride
Diff:
---
gcc/fortran/trans-array.cc | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 49190cf03895..36d6e9c31e8b 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3539,7 +3539,6 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
tree index;
tree desc;
tree data;
- tree stride = NULL_TREE;
info = &ss->info->data.array;
@@ -3619,29 +3618,26 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i,
gcc_assert (se->loop);
index = se->loop->loopvar[se->loop->order[i]];
- /* Pointer functions can have stride[0] different from unity.
- Use the stride returned by the function call and stored in
- the descriptor for the temporary. */
- if (se->ss && se->ss->info->type == GFC_SS_FUNCTION
- && se->ss->info->expr
- && se->ss->info->expr->symtree
- && se->ss->info->expr->symtree->n.sym->result
- && se->ss->info->expr->symtree->n.sym->result->attr.pointer)
- stride = gfc_conv_descriptor_stride_get (info->descriptor,
- gfc_rank_cst[dim]);
-
if (info->delta[dim] && !integer_zerop (info->delta[dim]))
index = fold_build2_loc (input_location, PLUS_EXPR,
gfc_array_index_type, index, info->delta[dim]);
}
- if (stride == NULL_TREE)
- {
- if (i == ss->loop->dimen - 1 && ss->loop->parent == NULL)
- stride = info->stride0;
- else
- stride = gfc_conv_array_stride (info->descriptor, dim);
- }
+ tree stride;
+ if (i == ss->loop->dimen - 1 && ss->loop->parent == NULL
+ && !(ar == nullptr
+ /* Pointer functions can have stride[0] different from unity.
+ Use the stride returned by the function call and stored in
+ the descriptor for the temporary in that case. */
+ && se->ss
+ && se->ss->info->type == GFC_SS_FUNCTION
+ && se->ss->info->expr
+ && se->ss->info->expr->symtree
+ && se->ss->info->expr->symtree->n.sym->result
+ && se->ss->info->expr->symtree->n.sym->result->attr.pointer))
+ stride = info->stride0;
+ else
+ stride = gfc_conv_array_stride (info->descriptor, dim);
return conv_array_index_dim (&info->current_elem, index, stride);
}
More information about the Gcc-cvs
mailing list