https://gcc.gnu.org/g:672626d98538ce879c832cab97b8f8a98747577d

commit 672626d98538ce879c832cab97b8f8a98747577d
Author: Mikael Morin <[email protected]>
Date:   Tue Oct 7 11:30:57 2025 +0200

    Correction régression result_in_spec_4.f90

Diff:
---
 gcc/fortran/trans-decl.cc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index ee156260a517..976a83822521 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -1323,9 +1323,23 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
                || (sym->attr.function && sym == sym->result))
               && gfc_return_by_reference (sym))
        packed = PACKED_NO;
-      else if (as->type == AS_ASSUMED_SIZE
-              || as->type == AS_EXPLICIT)
+      else if (as->type == AS_ASSUMED_SIZE)
        packed = PACKED_FULL;
+      else if (as->type == AS_EXPLICIT)
+       {
+         packed = PACKED_FULL;
+         for (int n = 0; n < as->rank; n++)
+           {
+             if (!(as->upper[n]
+                   && as->lower[n]
+                   && as->upper[n]->expr_type == EXPR_CONSTANT
+                   && as->lower[n]->expr_type == EXPR_CONSTANT))
+               {
+                 packed = PACKED_PARTIAL;
+                 break;
+               }
+           }
+       }
       else
        packed = PACKED_NO;

Reply via email to