https://gcc.gnu.org/g:ab66ab9fdffe1e0f33dc00427e3471e23066445c
commit ab66ab9fdffe1e0f33dc00427e3471e23066445c Author: Mikael Morin <mik...@gcc.gnu.org> Date: Mon Apr 14 17:43:04 2025 +0200 Correction régression ISO_Fortran_binding_14.f90 Diff: --- gcc/fortran/trans-types.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc index 6134efbc334e..b1bb2ba32728 100644 --- a/gcc/fortran/trans-types.cc +++ b/gcc/fortran/trans-types.cc @@ -1997,6 +1997,26 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed, else GFC_TYPE_ARRAY_SIZE (type) = NULL_TREE; + if (as->rank != 0) + { + tree max_idx; + if (known_stride) + { + mpz_t size; + mpz_init (size); + mpz_sub_ui (size, stride, 1); + max_idx = gfc_conv_mpz_to_tree (size, gfc_index_integer_kind); + } + else + max_idx = NULL_TREE; + + TYPE_DOMAIN (type) = build_range_type (gfc_array_index_type, + gfc_index_zero_node, max_idx); + TREE_TYPE (type) = etype; + } + + layout_type (type); + if (packed != PACKED_NO) GFC_TYPE_ARRAY_ELEM_LEN (type) = TYPE_SIZE_UNIT (etype);