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

commit c725d88c61692bd39c59d52fd7a5b9848f524859
Author: Mikael Morin <[email protected]>
Date:   Sat Sep 20 14:53:22 2025 +0200

    Correction anticipée régression pointer_function_result_1.f90

Diff:
---
 gcc/fortran/trans-array.cc | 4 ++--
 gcc/fortran/trans-array.h  | 3 ++-
 gcc/fortran/trans-expr.cc  | 6 ++++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 8d294fab90e4..49a9477a2814 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -961,7 +961,7 @@ tree
 gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * 
ss,
                             tree eltype, tree initial, bool dynamic,
                             bool dealloc, bool callee_alloc, locus * where,
-                            bool shift_bounds)
+                            bool shift_bounds, bool packed)
 {
   gfc_loopinfo *loop;
   gfc_ss *s;
@@ -1086,7 +1086,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, 
stmtblock_t * post, gfc_ss * ss,
 
   /* Initialize the descriptor.  */
   type =
-    gfc_get_array_type_bounds (eltype, total_dim, 0, from, to, 1,
+    gfc_get_array_type_bounds (eltype, total_dim, 0, from, to, packed,
                               GFC_ARRAY_UNKNOWN, true);
   desc = gfc_create_var (type, "atmp");
   GFC_DECL_PACKED_ARRAY (desc) = 1;
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 7cc4744e37ef..f81d5ede35a0 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -30,7 +30,8 @@ void gfc_set_loop_bounds_from_array_spec 
(gfc_interface_mapping *,
 /* Generate code to create a temporary array.  */
 tree gfc_trans_create_temp_array (stmtblock_t *, stmtblock_t *, gfc_ss *,
                                  tree, tree, bool, bool, bool, locus *,
-                                 bool shift_bounds = true);
+                                 bool shift_bounds = true,
+                                 bool packed = true);
 
 /* Generate function entry code for allocation of compiler allocated array
    variables.  */
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 1db72b693131..2506e108ca1d 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -8313,7 +8313,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
          gfc_trans_create_temp_array (&se->pre, &se->post, se->ss,
                                       tmp, NULL_TREE, false,
                                       !comp->attr.pointer, callee_alloc,
-                                      &se->ss->info->expr->where);
+                                      &se->ss->info->expr->where, true,
+                                      !IS_POINTER (comp));
 
          /* Pass the temporary as the first argument.  */
          result = info->descriptor;
@@ -8349,7 +8350,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
          gfc_trans_create_temp_array (&se->pre, &se->post, se->ss,
                                       tmp, NULL_TREE, false,
                                       !sym->attr.pointer, callee_alloc,
-                                      &se->ss->info->expr->where);
+                                      &se->ss->info->expr->where, true,
+                                      !IS_POINTER (sym));
 
          /* Pass the temporary as the first argument.  */
          result = info->descriptor;

Reply via email to