https://gcc.gnu.org/g:54cd4ae1122d7ec90f08506c0de65a3b936a4cc1

commit 54cd4ae1122d7ec90f08506c0de65a3b936a4cc1
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Thu Jan 16 20:45:34 2025 +0100

    Essai suppression unlimited_polymorphic

Diff:
---
 gcc/fortran/trans-array.cc | 13 ++++---------
 gcc/fortran/trans.h        |  3 ---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index e30e38aa2816..095a44dc8d3a 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -9040,7 +9040,7 @@ set_descriptor (stmtblock_t *block, tree dest, tree src, 
gfc_expr *src_expr,
                int rank, int corank, gfc_ss *ss, gfc_array_info *info,
                tree lowers[GFC_MAX_DIMENSIONS],
                tree uppers[GFC_MAX_DIMENSIONS],
-               bool unlimited_polymorphic, bool data_needed, bool subref)
+               bool data_needed, bool subref)
 {
   int ndim = info->ref ? info->ref->u.ar.dimen : rank;
 
@@ -9065,9 +9065,7 @@ set_descriptor (stmtblock_t *block, tree dest, tree src, 
gfc_expr *src_expr,
   /* Set the dtype.  */
   tmp = gfc_conv_descriptor_dtype (dest);
   tree dtype;
-  if (unlimited_polymorphic)
-    dtype = gfc_get_dtype (TREE_TYPE (src), &rank);
-  else if (src_expr->ts.type == BT_ASSUMED)
+  if (src_expr->ts.type == BT_ASSUMED)
     {
       tree tmp2 = src;
       if (DECL_LANG_SPECIFIC (tmp2) && GFC_DECL_SAVED_DESCRIPTOR (tmp2))
@@ -9077,7 +9075,7 @@ set_descriptor (stmtblock_t *block, tree dest, tree src, 
gfc_expr *src_expr,
       dtype = gfc_conv_descriptor_dtype (tmp2);
     }
   else
-    dtype = gfc_get_dtype (TREE_TYPE (dest));
+    dtype = gfc_get_dtype (TREE_TYPE (src), &rank);
   gfc_add_modify (block, tmp, dtype);
 
   /* The 1st element in the section.  */
@@ -9275,9 +9273,6 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
       expr = expr->value.function.actual->expr;
     }
 
-  if (!se->direct_byref)
-    se->unlimited_polymorphic = UNLIMITED_POLY (expr);
-
   /* Special case things we know we can pass easily.  */
   switch (expr->expr_type)
     {
@@ -9681,7 +9676,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr)
        }
 
       set_descriptor (&loop.pre, parm, desc, expr, loop.dimen, codim,
-                     ss, info, loop.from, loop.to, se->unlimited_polymorphic,
+                     ss, info, loop.from, loop.to,
                      !se->data_not_needed, subref_array_target);
 
       desc = parm;
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 8752f8c03818..e0cba5a1ea22 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -61,9 +61,6 @@ typedef struct gfc_se
      the reference to the class object here.  */
   tree class_container;
 
-  /* Whether expr is a reference to an unlimited polymorphic object.  */
-  unsigned unlimited_polymorphic:1;
-
   /* If set gfc_conv_variable will return an expression for the array
      descriptor. When set, want_pointer should also be set.
      If not set scalarizing variables will be substituted.  */

Reply via email to