https://gcc.gnu.org/g:449e41b363db2e482c912541214d43437f2e0dce

commit 449e41b363db2e482c912541214d43437f2e0dce
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Sun May 18 20:40:08 2025 +0200

    Correction régression pr78260-3

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

diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 7fcb50fcb685..3b8f8a538899 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -1343,12 +1343,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
 
       /* Even when -frepack-arrays is used, symbols with TARGET attribute
         are not repacked.  */
-      if (!flag_repack_arrays || sym->attr.target)
-       {
-         if (as->type == AS_ASSUMED_SIZE && !is_classarray)
-           packed = PACKED_FULL;
-       }
-      else
+      if (flag_repack_arrays && !sym->attr.target)
        {
          if (as->type == AS_EXPLICIT)
            {
@@ -1368,6 +1363,11 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
          else
            packed = PACKED_PARTIAL;
        }
+      else if ((as->type == AS_ASSUMED_SIZE && !is_classarray)
+              || ((sym->attr.result || sym->attr.function)
+                  && sym->ts.type != BT_CLASS
+                  && !sym->attr.pointer))
+       packed = PACKED_FULL;
 
       /* For classarrays the element type is required, but
         gfc_typenode_for_spec () returns the array descriptor.  */

Reply via email to