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

commit efef42cdf225b06e0c5c996e33507fa3d26568bc
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Sat Aug 16 18:46:41 2025 +0200

    Sauvegarde modif

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

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index 623bf4d8281c..81e172e8738a 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -1284,6 +1284,18 @@ shift_dimension_bounds (stmtblock_t * block, tree descr, 
tree dim,
 }
 
 
+static void
+shift_dimension_fields (stmtblock_t * block, tree descr, tree dim,
+                       tree new_lbound, tree orig_lbound, tree orig_ubound,
+                       tree orig_stride, tree *offset_value)
+{
+  tree stride = gfc_evaluate_now (orig_stride, block);
+  shift_dimension_bounds (block, descr, dim, new_lbound, orig_lbound, 
orig_ubound,
+                         stride, *offset_value);
+  gfc_conv_descriptor_dimension_set (block, descr, dim, stride);
+}
+
+
 /* Modify a descriptor such that the lbound of a given dimension is the value
    specified.  This also updates ubound and offset accordingly.  */
 
@@ -1428,12 +1440,10 @@ gfc_conv_shift_descriptor (stmtblock_t *block, tree 
dest, tree src,
 
       tree dim = gfc_rank_cst[n];
       tree stride = gfc_conv_descriptor_stride_get (src, dim);
-      shift_dimension_bounds (block, dest, gfc_rank_cst[n],
+      shift_dimension_fields (block, dest, gfc_rank_cst[n],
                              lbound, gfc_index_zero_node,
                              gfc_conv_descriptor_ubound_get (src, dim),
                              stride, &offset);
-
-      gfc_conv_descriptor_stride_set (block, dest, dim, stride);
     }
 
   gfc_conv_descriptor_offset_set (block, dest, offset);
@@ -2331,11 +2341,11 @@ gfc_set_temporary_descriptor (stmtblock_t *block, tree 
descr, tree class_src,
     for (int n = 0; n < rank; n++)
       {
        if (shift_bounds)
-         shift_dimension_bounds (block, descr, gfc_rank_cst[n],
+         shift_dimension_fields (block, descr, gfc_rank_cst[n],
                                  gfc_index_zero_node, lbound[n], ubound[n],
                                  stride[n], &offset);
        else
-         set_dimension_bounds (block, descr, gfc_rank_cst[n], lbound[n],
+         set_dimension_fields (block, descr, gfc_rank_cst[n], lbound[n],
                                ubound[n], stride[n], &offset);
       }

Reply via email to