https://gcc.gnu.org/g:85fd2ce8414825d0e3b2919bae29e74e1f8e6a41

commit 85fd2ce8414825d0e3b2919bae29e74e1f8e6a41
Author: Mikael Morin <mik...@gcc.gnu.org>
Date:   Fri Apr 18 15:50:24 2025 +0200

    Correction ICE pr61775 (taille de tableaux de rang 1 non connue)

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

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 5d2e2e3132bc..8aae57118f50 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -4587,7 +4587,7 @@ done:
 
        case GFC_SS_CONSTRUCTOR:
          {
-           gcc_assert (info->shape != nullptr);
+           gcc_assert (info->shape != nullptr || ss->dimen == 1);
            tree type = gfc_typenode_for_spec (&ss_info->expr->ts);
            tree spacing = fold_convert_loc (input_location,
                                             gfc_array_index_type,
@@ -4600,11 +4600,14 @@ done:
                info->end[dim]    = gfc_index_zero_node;
                info->stride[dim] = gfc_index_one_node;
                info->spacing[dim] = spacing;
-               tree extent = gfc_conv_mpz_to_tree_type (info->shape[n],
-                                               gfc_array_index_type);
-               spacing = fold_build2_loc (input_location, MULT_EXPR,
-                                          gfc_array_index_type, spacing,
-                                          extent);
+               if (n < ss->dimen - 1)
+                 {
+                   tree extent = gfc_conv_mpz_to_tree_type (info->shape[n],
+                                                   gfc_array_index_type);
+                   spacing = fold_build2_loc (input_location, MULT_EXPR,
+                                              gfc_array_index_type, spacing,
+                                              extent);
+                 }
              }
          }
          break;

Reply via email to