[gcc(refs/users/mikael/heads/refactor_descriptor_v291 .01)] Déplacement initialisation dernière borne sup assumed size

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

commit d3016546187f09be3eb1cb86c344464c65080cec
Author: Mikael Morin <[email protected]>
Date:   Sun Aug 10 11:13:41 2025 +0200

    Déplacement initialisation dernière borne sup assumed size

Diff:
---
 gcc/fortran/trans-array.cc | 37 ++++++++++++++++++++++---------------
 gcc/fortran/trans-expr.cc  | 32 --------------------------------
 2 files changed, 22 insertions(+), 47 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 3cf737e43fb8..9f19f93a2c52 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8096,21 +8096,28 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
 	    expr->ts.u.cl->backend_decl = tmp;
 	}
 
-      /* If we have an array section, are assigning  or passing an array
-	 section argument make sure that the lower bound is 1.  References
-	 to the full array should otherwise keep the original bounds.  */
-      if (!info->ref || info->ref->u.ar.type != AR_FULL)
-	for (dim = 0; dim < loop.dimen; dim++)
-	  if (!integer_onep (loop.from[dim]))
-	    {
-	      tmp = fold_build2_loc (input_location, MINUS_EXPR,
-				     gfc_array_index_type, gfc_index_one_node,
-				     loop.from[dim]);
-	      loop.to[dim] = fold_build2_loc (input_location, PLUS_EXPR,
-					      gfc_array_index_type,
-					      loop.to[dim], tmp);
-	      loop.from[dim] = gfc_index_one_node;
-	    }
+      if (info->ref && info->ref->u.ar.type == AR_FULL)
+	{
+	  if (info->ref->u.ar.as->type == AS_ASSUMED_SIZE)
+	    loop.to[loop.dimen - 1] = build_int_cst (gfc_array_index_type, -1);
+	}
+      else
+	{
+	  /* If we have an array section, are assigning  or passing an array
+	     section argument make sure that the lower bound is 1.  References
+	     to the full array should otherwise keep the original bounds.  */
+	  for (dim = 0; dim < loop.dimen; dim++)
+	    if (!integer_onep (loop.from[dim]))
+	      {
+		tmp = fold_build2_loc (input_location, MINUS_EXPR,
+				       gfc_array_index_type, gfc_index_one_node,
+				       loop.from[dim]);
+		loop.to[dim] = fold_build2_loc (input_location, PLUS_EXPR,
+						gfc_array_index_type,
+						loop.to[dim], tmp);
+		loop.from[dim] = gfc_index_one_node;
+	      }
+	}
 
       desc = info->descriptor;
       if (se->direct_byref && !se->byref_noassign)
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index b5dd4baa749c..bdcf97a82d3c 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7786,38 +7786,6 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
 		}
 	    }
 	}
-      /* Special case for an assumed-rank dummy argument. */
-      if (!sym->attr.is_bind_c && e && fsym && e->rank > 0
-	  && (fsym->ts.type == BT_CLASS
-	      ? (CLASS_DATA (fsym)->as
-		 && CLASS_DATA (fsym)->as->type == AS_ASSUMED_RANK)
-	      : (fsym->as && fsym->as->type == AS_ASSUMED_RANK))
-	  && !(fsym->ts.type == BT_CLASS
-	       ? (CLASS_DATA (fsym)->attr.class_pointer
-		  || CLASS_DATA (fsym)->attr.allocatable)
-	       : (fsym->attr.pointer || fsym->attr.allocatable))
-	  && e->expr_type == EXPR_VARIABLE
-	  && e->symtree->n.sym->attr.dummy
-	  && (e->ts.type == BT_CLASS
-	      ? (e->ref && e->ref->next
-		 && e->ref->next->type == REF_ARRAY
-		 && e->ref->next->u.ar.type == AR_FULL
-		 && e->ref->next->u.ar.as->type == AS_ASSUMED_SIZE)
-	      : (e->ref && e->ref->type == REF_ARRAY
-		 && e->ref->u.ar.type == AR_FULL
-		 && e->ref->u.ar.as->type == AS_ASSUMED_SIZE)))
-	{
-	  /* Assumed-size actual to assumed-rank dummy requires
-	     dim[rank-1].ubound = -1. */
-	  tree minus_one;
-	  tmp = build_fold_indirect_ref_loc (input_location, parmse.expr);
-	  if (fsym->ts.type == BT_CLASS)
-	    tmp = gfc_class_data_get (tmp);
-	  minus_one = build_int_cst (gfc_array_index_type, -1);
-	  gfc_conv_descriptor_ubound_set (&parmse.pre, tmp,
-					  gfc_rank_cst[e->rank - 1],
-					  minus_one);
-	}
 
       /* The case with fsym->attr.optional is that of a user subroutine
 	 with an interface indicating an optional argument.  When we call
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.