https://gcc.gnu.org/g:3eb2ed2fb0030f250581b92a656122ecfd977efd

commit 3eb2ed2fb0030f250581b92a656122ecfd977efd
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Tue Apr 29 15:27:11 2025 +0200

    Correction régression realloc_on_assign_10

Diff:
---
 gcc/fortran/trans-descriptor.cc | 32 +++-----------------------------
 gcc/fortran/trans-descriptor.h  |  2 +-
 gcc/fortran/trans-expr.cc       |  2 +-
 3 files changed, 5 insertions(+), 31 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 91768ac4b18a..2e25a022655b 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -2142,27 +2142,10 @@ conv_shift_descriptor (stmtblock_t *block, tree desc, 
int rank,
 }
 
 
-class cond_descr_lb : public lb_info_base
-{
-  tree desc;
-  tree cond;
-public:
-  cond_descr_lb (tree arg_desc, tree arg_cond)
-    : desc (arg_desc), cond (arg_cond) { }
-
-  virtual tree lower_bound (stmtblock_t *block, int dim) const;
-  virtual bool zero_based_src () const { return true; }
-};
-
-
-tree
-cond_descr_lb::lower_bound (stmtblock_t *block ATTRIBUTE_UNUSED, int dim) const
+void
+gfc_conv_shift_descriptor (stmtblock_t* block, tree dest, tree src, int rank)
 {
-  tree lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim]);
-  lbound = fold_build3_loc (input_location, COND_EXPR,
-                           gfc_array_index_type, cond,
-                           gfc_index_one_node, lbound);
-  return lbound;
+  conv_shift_descriptor (block, src, dest, rank, unset_lb ());
 }
 
 
@@ -2440,15 +2423,6 @@ gfc_conv_remap_descriptor (stmtblock_t *block, tree 
dest, tree src,
 }
 
 
-void
-gfc_conv_shift_descriptor (stmtblock_t *block, tree dest, tree src,
-                          int rank, tree zero_cond)
-{
-  conv_shift_descriptor (block, src, dest, rank,
-                        cond_descr_lb (src, zero_cond));
-}
-
-
 void
 gfc_copy_descriptor (stmtblock_t *block, tree dest, tree src,
                     gfc_expr *src_expr, bool subref)
diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h
index 33d0a2ca4040..5556ed6ae12b 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -84,7 +84,7 @@ tree gfc_get_cfi_dim_sm (tree, tree);
 tree gfc_build_desc_array_type (tree, tree, int, tree *, 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);
+void gfc_conv_shift_descriptor (stmtblock_t*, tree, tree, int);
 void gfc_conv_shift_descriptor_subarray (stmtblock_t*, tree, gfc_expr *, 
gfc_expr *);
 void gfc_conv_shift_descriptor (stmtblock_t *, tree, int, tree *, tree *);
 
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 5f0601ed3439..56668cc7be9a 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -11536,7 +11536,7 @@ fcncall_realloc_result (gfc_se *se, int rank, tree 
dtype)
   /* Now reset the bounds returned from the function call to bounds based
      on the lhs lbounds, except where the lhs is not allocated or the shapes
      of 'variable and 'expr' are different. Set the offset accordingly.  */
-  gfc_conv_shift_descriptor (&se->post, desc, res_desc, rank, zero_cond);
+  gfc_conv_shift_descriptor (&se->post, desc, res_desc, rank);
 }

Reply via email to