https://gcc.gnu.org/g:dc0220b64f510e20fb6316aeb2cfc7d3f5b6fda7

commit dc0220b64f510e20fb6316aeb2cfc7d3f5b6fda7
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 a0236f30843d..22a6fb6942e2 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -2155,27 +2155,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 ());
 }
 
 
@@ -2453,15 +2436,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 5cdf324cf8e3..092a2b8abddc 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -81,7 +81,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 364123ce3ed5..612dea0c46a5 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -11477,7 +11477,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