[gcc(refs/users/mikael/heads/refactor_descriptor_v08)] Calcul offset sans passer par le descripteur

Mikael Morin mikael@gcc.gnu.org
Fri Sep 19 20:02:32 GMT 2025


https://gcc.gnu.org/g:50f8378f70dcc37e3f330fe92cdd2fccc4c2dd96

commit 50f8378f70dcc37e3f330fe92cdd2fccc4c2dd96
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Sat Aug 16 16:17:52 2025 +0200

    Calcul offset sans passer par le descripteur

Diff:
---
 gcc/fortran/trans-descriptor.cc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index ae387b684e8c..c0961ee1ab89 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -1425,7 +1425,7 @@ gfc_conv_remap_descriptor (stmtblock_t *block, tree dest, int dest_rank,
 
   /* Copy offset but adjust it such that it would correspond
      to a lbound of zero.  */
-  gfc_conv_descriptor_offset_set (block, dest, gfc_index_zero_node);
+  tree offset = gfc_index_zero_node;
 
   /* Set the bounds as declared for the LHS and calculate strides as
      well as another offset update accordingly.  */
@@ -1476,17 +1476,15 @@ gfc_conv_remap_descriptor (stmtblock_t *block, tree dest, int dest_rank,
       gfc_conv_descriptor_stride_set (block, dest, gfc_rank_cst[dim], stride);
 
       /* Update offset.  */
-      tree offs = gfc_conv_descriptor_offset_get (dest);
       tree tmp = fold_build2_loc (input_location, MULT_EXPR,
 				  gfc_array_index_type, lbound, stride);
-      offs = fold_build2_loc (input_location, MINUS_EXPR,
-			      gfc_array_index_type, offs, tmp);
-      offs = gfc_evaluate_now (offs, block);
-      gfc_conv_descriptor_offset_set (block, dest, offs);
+      offset = fold_build2_loc (input_location, MINUS_EXPR,
+				gfc_array_index_type, offset, tmp);
 
       /* Update stride.  */
       tmp = gfc_conv_array_extent_dim (lbound, ubound, NULL);
       stride = fold_build2_loc (input_location, MULT_EXPR,
 				gfc_array_index_type, stride, tmp);
     }
+  gfc_conv_descriptor_offset_set (block, dest, offset);
 }


More information about the Gcc-cvs mailing list