https://gcc.gnu.org/g:650dc7274c9d7bab9a010ae93fca1aee7e2ee1f0

commit 650dc7274c9d7bab9a010ae93fca1aee7e2ee1f0
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 c8d56ec55999..0c07de4bd18a 100644
--- a/gcc/fortran/trans-types.cc
+++ b/gcc/fortran/trans-types.cc
@@ -1994,6 +1994,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);

Reply via email to