https://gcc.gnu.org/g:38693c4f10eee24519189bfaebb283f93c605be4

commit 38693c4f10eee24519189bfaebb283f93c605be4
Author: Mikael Morin <[email protected]>
Date:   Wed Oct 8 13:49:14 2025 +0200

    Correction régression asumed_rank_25.f90

Diff:
---
 gcc/fortran/trans-expr.cc | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 6fcff2ff1ec0..d2d3d9c6282a 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -5461,6 +5461,7 @@ gfc_conv_subref_array_arg (gfc_se *se, gfc_expr * expr, 
int g77,
                                              : NULL),
                                  loop.dimen);
   loop.temp_ss->info->data.temp.preserve_bounds = preserve_bounds;
+  loop.temp_ss->info->data.temp.bytes_strided = se->bytes_strided;
 
   parmse->string_length = loop.temp_ss->info->string_length;
 
@@ -6979,6 +6980,19 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
          gfc_ss *argss;
 
          gfc_init_se (&parmse, NULL);
+         if ((expr
+              && expr->expr_type == EXPR_FUNCTION
+              && expr->value.function.isym != nullptr)
+             || (sym
+                 && (sym->attr.proc == PROC_INTRINSIC
+                     || sym->attr.intrinsic))
+             || (fsym
+                 && fsym->as
+                 && (fsym->as->type == AS_ASSUMED_SHAPE
+                     || fsym->as->type == AS_ASSUMED_RANK)
+                 && !(fsym->attr.allocatable
+                      || fsym->attr.contiguous)))
+           parmse.bytes_strided = 1;
 
          /* Check whether the expression is a scalar or not; we cannot use
             e->rank as it can be nonzero for functions arguments.  */
@@ -7631,11 +7645,6 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                {
                  /* This is where we introduce a temporary to store the
                     result of a non-lvalue array expression.  */
-                 if ((expr
-                      && expr->expr_type == EXPR_FUNCTION
-                      && expr->value.function.isym != nullptr)
-                     || (sym && sym->attr.proc == PROC_INTRINSIC))
-                   parmse.bytes_strided = 1;
                  gfc_conv_array_parameter (&parmse, e, nodesc_arg, fsym,
                                            sym->name, NULL);
                }

Reply via email to