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

commit a4def742b2cc39af8ad60ee8172536df8cf285fb
Author: Mikael Morin <[email protected]>
Date:   Thu Oct 2 11:04:52 2025 +0200

    Correction régression class_allocate_21.f90

Diff:
---
 gcc/fortran/trans-array.cc | 25 +++++++++++++------------
 gcc/fortran/trans-expr.cc  | 21 ++++++++++++++++-----
 2 files changed, 29 insertions(+), 17 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 579591c218e3..d0aafd976d99 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -8654,18 +8654,19 @@ gfc_conv_array_parameter (gfc_se *se, gfc_expr *expr, 
bool g77,
       /* Every other type of array.  */
       se->want_pointer = (ctree) ? 0 : 1;
       se->want_coarray = expr->corank;
-      se->bytes_strided = fsym
-                         && ((fsym->ts.type != BT_CLASS
-                              && !fsym->attr.contiguous
-                              && (fsym->attr.pointer
-                                  || (fsym->as
-                                      && fsym->as->type == AS_ASSUMED_SHAPE)))
-                             || (fsym->ts.type == BT_CLASS
-                                 && CLASS_DATA (fsym)->attr.contiguous
-                                 && (CLASS_DATA (fsym)->attr.class_pointer
-                                     || (CLASS_DATA (fsym)->as
-                                         && CLASS_DATA (fsym)->as->type
-                                            == AS_ASSUMED_SHAPE))));
+      if (!se->bytes_strided)
+       se->bytes_strided = fsym
+                           && ((fsym->ts.type != BT_CLASS
+                                && !fsym->attr.contiguous
+                                && (fsym->attr.pointer
+                                    || (fsym->as
+                                        && fsym->as->type == 
AS_ASSUMED_SHAPE)))
+                               || (fsym->ts.type == BT_CLASS
+                                   && CLASS_DATA (fsym)->attr.contiguous
+                                   && (CLASS_DATA (fsym)->attr.class_pointer
+                                       || (CLASS_DATA (fsym)->as
+                                           && CLASS_DATA (fsym)->as->type
+                                              == AS_ASSUMED_SHAPE))));
       gfc_conv_expr_descriptor (se, expr);
 
       if (size)
diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
index 2c9affb60fc0..68794ec6b08a 100644
--- a/gcc/fortran/trans-expr.cc
+++ b/gcc/fortran/trans-expr.cc
@@ -7621,10 +7621,16 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                                             fsym->attr.pointer);
                }
              else
-               /* This is where we introduce a temporary to store the
-                  result of a non-lvalue array expression.  */
-               gfc_conv_array_parameter (&parmse, e, nodesc_arg, fsym,
-                                         sym->name, NULL);
+               {
+                 /* 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)
+                   parmse.bytes_strided = 1;
+                 gfc_conv_array_parameter (&parmse, e, nodesc_arg, fsym,
+                                           sym->name, NULL);
+               }
 
              /* If an ALLOCATABLE dummy argument has INTENT(OUT) and is
                 allocated on entry, it must be deallocated.
@@ -8366,7 +8372,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
                                       !sym->attr.pointer, callee_alloc,
                                       &se->ss->info->expr->where, true,
                                       !IS_POINTER (sym)
-                                      && !se->bytes_strided);
+                                      && !se->bytes_strided
+                                      && !(expr
+                                           && expr->expr_type == EXPR_FUNCTION
+                                           && expr->value.function.isym
+                                           && expr->value.function.isym->id
+                                              == GFC_ISYM_RESHAPE));
 
          /* Pass the temporary as the first argument.  */
          result = info->descriptor;

Reply via email to