https://gcc.gnu.org/g:bc20c4d2b1246b7f6a5aabd015ac5568a71c6ed4
commit bc20c4d2b1246b7f6a5aabd015ac5568a71c6ed4 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Fri Apr 25 15:51:31 2025 +0200 Correction régression repack_arrays_1 Diff: --- gcc/fortran/trans-array.cc | 6 ++++++ gcc/fortran/trans-decl.cc | 4 +++- gcc/fortran/trans-types.cc | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index dc402ed88251..b34e03bda718 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -6395,6 +6395,12 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, if (!onstack) type = TREE_TYPE (type); + if (!GFC_TYPE_ARRAY_ELEM_LEN (type)) + { + gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); + return; + } + size = gfc_trans_array_bounds (type, sym, &offset, &init); /* Set offset of the array. */ diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index f5fdba0889c4..6f2567d943ec 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -1260,7 +1260,9 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) suppress_warning (GFC_TYPE_ARRAY_SIZE (type)); } - if (! COMPLETE_TYPE_P (type) && GFC_TYPE_ARRAY_SIZE (type)) + if (! COMPLETE_TYPE_P (type) + && GFC_TYPE_ARRAY_SIZE (type) + && GFC_DECL_PACKED_ARRAY (decl)) { tree size, range; diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc index ca91c428a819..52f74724735c 100644 --- a/gcc/fortran/trans-types.cc +++ b/gcc/fortran/trans-types.cc @@ -1869,7 +1869,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed, mpz_init_set_ui (stride, 1); mpz_init (spc); - bool known_spacing = INTEGER_CST_P (TYPE_SIZE_UNIT (etype)); + bool known_spacing = packed != PACKED_NO && INTEGER_CST_P (TYPE_SIZE_UNIT (etype)); if (known_spacing) { wide_int elem_len = wi::to_wide (TYPE_SIZE_UNIT (etype));