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

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

commit 8c7b5593ed9156391d26f11c9fd08c775f2ce528
Author: Mikael Morin <[email protected]>
Date:   Fri Jul 18 14:45:07 2025 +0200

    Factorisation gfc_conv_shift_descriptor
    
    Factorisation gfc_conv_shift_descriptor
    
    Correction compil' suite factorisation gfc_conv_shift_descriptor

Diff:
---
 gcc/fortran/trans-expr.cc | 17 +++--------------
 gcc/fortran/trans-stmt.cc |  6 +-----
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 28727104de20..aefd7a770c64 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -1095,7 +1095,6 @@ gfc_conv_intrinsic_to_class (gfc_se *parmse, gfc_expr *e,
   tree ctree;
   tree var;
   tree tmp;
-  int dim;
   bool unlimited_poly;
 
   unlimited_poly = class_ts.type == BT_CLASS
@@ -1162,11 +1161,7 @@ gfc_conv_intrinsic_to_class (gfc_se *parmse, gfc_expr *e,
 	  /* Array references with vector subscripts and non-variable expressions
 	     need be converted to a one-based descriptor.  */
 	  if (e->expr_type != EXPR_VARIABLE)
-	    {
-	      for (dim = 0; dim < e->rank; ++dim)
-		gfc_conv_shift_descriptor_lbound (&parmse->pre, parmse->expr,
-						  dim, gfc_index_one_node);
-	    }
+	    gfc_conv_shift_descriptor (&parmse->pre, parmse->expr, e->rank);
 
 	  if (class_ts.u.derived->components->as->rank != e->rank)
 	    {
@@ -7741,14 +7736,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
 	      gfc_init_block (&class_se.post);
 
 	      if (e->expr_type != EXPR_VARIABLE)
-		{
-		  int n;
-		  /* Set the bounds and offset correctly.  */
-		  for (n = 0; n < e->rank; n++)
-		    gfc_conv_shift_descriptor_lbound (&class_se.pre,
-						      class_se.expr,
-						      n, gfc_index_one_node);
-		}
+		gfc_conv_shift_descriptor (&class_se.pre, class_se.expr,
+					   e->rank);
 
 	      /* The conversion does not repackage the reference to a class
 	         array - _data descriptor.  */
diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc
index 5cffe356f655..0c07ec3a1396 100644
--- a/gcc/fortran/trans-stmt.cc
+++ b/gcc/fortran/trans-stmt.cc
@@ -2145,16 +2145,12 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block)
       if ((!sym->assoc->variable && !cst_array_ctor)
 	  || !whole_array)
 	{
-	  int dim;
-
 	  if (whole_array)
 	    gfc_add_modify (&se.pre, desc, se.expr);
 
 	  /* The generated descriptor has lower bound zero (as array
 	     temporary), shift bounds so we get lower bounds of 1.  */
-	  for (dim = 0; dim < e->rank; ++dim)
-	    gfc_conv_shift_descriptor_lbound (&se.pre, desc,
-					      dim, gfc_index_one_node);
+	  gfc_conv_shift_descriptor (&se.pre, desc, e->rank);
 	}
 
       if (e->expr_type == EXPR_FUNCTION && IS_PDT (e))
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.