[gcc(refs/users/mikael/heads/refactor_descriptor_v291.01)] Modification initialisation stride

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

commit db40e5301a08629ca637d47b9881f96fe018ace4
Author: Mikael Morin <[email protected]>
Date:   Sat Aug 16 15:42:30 2025 +0200

    Modification initialisation stride
    
    Revert "Suppression argument inutilisé"
    
    This reverts commit eaf4e13d38467b15714bbc36a49bda4460ebabab.
    
    Revert "Suppression warning argument inutilisé"
    
    This reverts commit ff23b550241409fcd70380c28c82ef19fc47bc75.
    
    Revert "Revert partiel initialisation stride"
    
    This reverts commit 0af062cb83c70fea79c98f76ca45b13376e567d7.

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

diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc
index d8f20684084a..5b888e38c99c 100644
--- a/gcc/fortran/trans-descriptor.cc
+++ b/gcc/fortran/trans-descriptor.cc
@@ -1562,7 +1562,8 @@ gfc_copy_descriptor (stmtblock_t *block, tree dest, tree src, tree ptr,
 
 void
 gfc_conv_remap_descriptor (stmtblock_t *block, tree dest, int dest_rank,
-			   tree src, gfc_typespec *src_type, gfc_array_ref *ar,
+			   tree src, gfc_typespec *src_type,
+			   bool contiguous_src, gfc_array_ref *ar,
 			   bool unlimited_poly_dest)
 {
   /* Set dtype.  */
@@ -1602,7 +1603,12 @@ gfc_conv_remap_descriptor (stmtblock_t *block, tree dest, int dest_rank,
 
   /* Set the bounds as declared for the LHS and calculate strides as
      well as another offset update accordingly.  */
-  tree stride = gfc_conv_descriptor_stride_get (src, gfc_rank_cst[0]);
+  tree stride;
+  if (contiguous_src)
+    stride = gfc_index_one_node;
+  else
+    stride = gfc_conv_descriptor_stride_get (src, gfc_rank_cst[0]);
+
   for (int dim = 0; dim < dest_rank; ++dim)
     {
       gfc_se lower_se;
diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h
index 658049a8b592..5481791a134f 100644
--- a/gcc/fortran/trans-descriptor.h
+++ b/gcc/fortran/trans-descriptor.h
@@ -101,7 +101,7 @@ void gfc_copy_descriptor (stmtblock_t *, tree, tree, tree, int);
 void gfc_copy_descriptor (stmtblock_t *, tree, tree, bool);
 
 void gfc_conv_remap_descriptor (stmtblock_t *, tree, int, tree, gfc_typespec *,
-				gfc_array_ref *, bool);
+				bool, gfc_array_ref *, bool);
 
 void gfc_set_descriptor_from_scalar_class (stmtblock_t *, tree, tree, gfc_expr *);
 void gfc_set_descriptor_from_scalar (stmtblock_t *, tree, tree, symbol_attribute,
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 71adb9d9a44b..3b96f0dae941 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -11284,8 +11284,8 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2)
 		 converted in rse and now have to build the correct LHS
 		 descriptor for it.  */
 	      gfc_conv_remap_descriptor (&block, desc, expr1->rank, rse.expr,
-					 &expr2->ts, &remap->u.ar,
-					 UNLIMITED_POLY (expr1));
+					 &expr2->ts, expr2->rank != 1,
+					 &remap->u.ar, UNLIMITED_POLY (expr1));
 	    }
 	  else
 	    /* Bounds remapping.  Just shift the lower bounds.  */
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.