https://gcc.gnu.org/g:5df96158884af3d1dfb03a4ab345797b036efe9b

commit 5df96158884af3d1dfb03a4ab345797b036efe9b
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Wed May 7 22:21:41 2025 +0200

    Suppression borne supérieure type si dynamique

Diff:
---
 gcc/fortran/trans-array.cc | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 18ffdd5c917d..842156b36158 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -1049,10 +1049,22 @@ gfc_trans_create_temp_array (stmtblock_t * pre, 
stmtblock_t * post, gfc_ss * ss,
        }
     }
 
-  /* Initialize the descriptor.  */
+  /* Clear type upper bound if dynamic.  */
+  tree to0 = NULL_TREE;
+  if (dynamic && total_dim == 1)
+    {
+      to0 = to[0];
+      to[0] = NULL_TREE;
+    }
   type =
     gfc_get_array_type_bounds (eltype, total_dim, 0, from, to, 1,
                               GFC_ARRAY_UNKNOWN, true);
+  /* Restore the upper bound, for the rest (not type-related) of the descriptor
+     initialization.  */
+  if (to0)
+    to[0] = to0;
+
+  /* Initialize the descriptor.  */
   desc = gfc_create_var (type, "atmp");
   GFC_DECL_PACKED_ARRAY (desc) = 1;

Reply via email to