[gcc(refs/users/mikael/heads/refactor_descriptor_v291.01)] Factorisation set_dimension_fields gfc_set_descriptor

Mikael Morin via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:762db50405e0e9a97f2a2ddb3b40b9d4ac1f4460

commit 762db50405e0e9a97f2a2ddb3b40b9d4ac1f4460
Author: Mikael Morin <[email protected]>
Date:   Sat Aug 16 18:11:01 2025 +0200

    Factorisation set_dimension_fields gfc_set_descriptor

Diff:
---
 gcc/fortran/trans-descriptor.cc | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 562aa5c72d34..97100fd9c231 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -1846,27 +1846,14 @@ gfc_set_descriptor (stmtblock_t *block, tree dest, tree src, gfc_expr *src_expr,
       tree from = lowers[dim];
       tree to = uppers[dim];
 
-      gfc_conv_descriptor_lbound_set (block, dest,
-				      gfc_rank_cst[dim], from);
-
-      /* Set the new upper bound.  */
-      gfc_conv_descriptor_ubound_set (block, dest,
-				      gfc_rank_cst[dim], to);
-
       /* Multiply the stride by the section stride to get the
 	 total stride.  */
       stride = fold_build2_loc (input_location, MULT_EXPR,
 				gfc_array_index_type,
 				stride, info->stride[n]);
 
-      tmp = fold_build2_loc (input_location, MULT_EXPR,
-			     TREE_TYPE (offset), stride, from);
-      offset = fold_build2_loc (input_location, MINUS_EXPR,
-			       TREE_TYPE (offset), offset, tmp);
-
-      /* Store the new stride.  */
-      gfc_conv_descriptor_stride_set (block, dest,
-				      gfc_rank_cst[dim], stride);
+      set_dimension_fields (block, dest, gfc_rank_cst[dim], from, to, stride,
+			    &offset);
     }
 
   /* For deferred-length character we need to take the dynamic length
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.