https://gcc.gnu.org/g:e6313ff0bd2230621d678b00e5db148e70b8b574

commit e6313ff0bd2230621d678b00e5db148e70b8b574
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Wed Feb 19 20:06:10 2025 +0100

    Correction initialisation bornes temp alloc_comp_assign_12.f03

Diff:
---
 gcc/fortran/trans-array.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 69dbcc31cc4a..2d6519f8b0b6 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -3672,7 +3672,7 @@ set_temporary_descriptor (stmtblock_t *block, tree desc, 
tree class_src,
                          tree lbound[GFC_MAX_DIMENSIONS],
                          tree ubound[GFC_MAX_DIMENSIONS],
                          tree stride[GFC_MAX_DIMENSIONS], int rank,
-                         bool callee_allocated, bool rank_changer,
+                         bool omit_bounds, bool rank_changer,
                          bool shift_bounds)
 {
   int n;
@@ -3700,7 +3700,7 @@ set_temporary_descriptor (stmtblock_t *block, tree desc, 
tree class_src,
     }
 
   tree offset = gfc_index_zero_node;
-  if (!callee_allocated)
+  if (!omit_bounds)
     {
       for (n = 0; n < rank; n++)
        {
@@ -4032,6 +4032,8 @@ gfc_trans_create_temp_array (stmtblock_t * pre, 
stmtblock_t * post, gfc_ss * ss,
        }
     }
 
+  bool bounds_known = size != NULL_TREE;
+
   /* Get the size of the array.  */
   if (size && !callee_alloc)
     {
@@ -4055,8 +4057,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, 
stmtblock_t * post, gfc_ss * ss,
                                                    dealloc);
 
   set_temporary_descriptor (pre, desc, class_expr, elemsize, data_ptr,
-                           from, to, stride, total_dim,
-                           size == NULL_TREE || callee_alloc,
+                           from, to, stride, total_dim, !bounds_known,
                            rank_changer, shift_bounds);
 
   while (ss->parent)

Reply via email to