https://gcc.gnu.org/g:7421792ba1ee3c272b294ac19a85bc43ad73e3c7

commit 7421792ba1ee3c272b294ac19a85bc43ad73e3c7
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Thu Jan 16 14:35:14 2025 +0100

    Factorisation shift descriptor

Diff:
---
 gcc/fortran/trans-array.cc | 6 +++---
 gcc/fortran/trans-array.h  | 1 +
 gcc/fortran/trans-stmt.cc  | 6 +-----
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index ec0badd0dc33..ecdaad3f9575 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -1257,8 +1257,8 @@ conv_shift_descriptor (stmtblock_t *block, tree desc, int 
rank,
 }
 
 
-static void
-conv_shift_descriptor (stmtblock_t* block, tree desc, int rank)
+void
+gfc_conv_shift_descriptor (stmtblock_t* block, tree desc, int rank)
 {
   conv_shift_descriptor (block, desc, rank, unset_lb ());
 }
@@ -10103,7 +10103,7 @@ gfc_conv_array_parameter (gfc_se *se, gfc_expr *expr, 
bool g77,
 
          gfc_init_block (&block);
          if (maybe_shift && !keep_descriptor_lower_bound (expr))
-           conv_shift_descriptor (&block, se->expr, expr->rank);
+           gfc_conv_shift_descriptor (&block, se->expr, expr->rank);
 
          bool assumed_rank_fsym;
          if (fsym
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 571322ae11ff..378afb9617a3 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -216,6 +216,7 @@ tree gfc_get_cfi_dim_sm (tree, tree);
 /* Shift lower bound of descriptor, updating ubound and offset.  */
 void gfc_conv_shift_descriptor_lbound (stmtblock_t*, tree, int, tree);
 void gfc_conv_shift_descriptor (stmtblock_t*, tree, const gfc_array_ref &);
+void gfc_conv_shift_descriptor (stmtblock_t*, tree, int);
 void gfc_conv_shift_descriptor (stmtblock_t*, tree, tree, int, tree);
 
 /* Add pre-loop scalarization code for intrinsic functions which require
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index e7da8fea3b24..01fb8d91007f 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -2007,16 +2007,12 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block 
*block)
       if ((!sym->assoc->variable && !cst_array_ctor)
          || !whole_array)
        {
-         int dim;
-
          if (whole_array)
            gfc_add_modify (&se.pre, desc, se.expr);
 
          /* The generated descriptor has lower bound zero (as array
             temporary), shift bounds so we get lower bounds of 1.  */
-         for (dim = 0; dim < e->rank; ++dim)
-           gfc_conv_shift_descriptor_lbound (&se.pre, desc,
-                                             dim, gfc_index_one_node);
+         gfc_conv_shift_descriptor (&se.pre, desc, e->rank);
        }
 
       /* If this is a subreference array pointer associate name use the

Reply via email to