[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction ICE pr61775 (taille de tableaux de rang 1 non connue)

Mikael Morin mikael@gcc.gnu.org
Fri Jun 13 14:56:39 GMT 2025


https://gcc.gnu.org/g:695765b7ba4e2a8a871080d9003362f719275c72

commit 695765b7ba4e2a8a871080d9003362f719275c72
Author: Mikael Morin <mikael@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 8350173648a5..a92ac70a53c2 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;


More information about the Gcc-cvs mailing list