[gcc(refs/users/mikael/heads/refactor_descriptor_v05)] Correction régression array_assignment_5

Mikael Morin mikael@gcc.gnu.org
Fri Jun 13 15:00:19 GMT 2025


https://gcc.gnu.org/g:6f8d3383f7ef77bfa647360e993e477bcb80c5c9

commit 6f8d3383f7ef77bfa647360e993e477bcb80c5c9
Author: Mikael Morin <mikael@gcc.gnu.org>
Date:   Wed Apr 30 12:29:42 2025 +0200

    Correction régression array_assignment_5

Diff:
---
 gcc/fortran/trans-array.cc | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc
index 563b8e35607a..f79781584928 100644
--- a/gcc/fortran/trans-array.cc
+++ b/gcc/fortran/trans-array.cc
@@ -2826,22 +2826,34 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
 		    && ss_info->expr->ts.type != BT_CLASS)
 		  {
 		    tree type = gfc_typenode_for_spec (&ss_info->expr->ts);
-		    tree spacing = fold_convert_loc (input_location,
-						     gfc_array_index_type, 
-						     TYPE_SIZE_UNIT (type));
-		    spacing = gfc_evaluate_now (spacing, &outer_loop->pre);
-
-		    for (n = 0; n < ss_info->expr->rank; n++)
+		    if (TYPE_SIZE_UNIT (type) == NULL_TREE)
+		      {
+			for (n = 0; n < ss_info->expr->rank; n++)
+			  {
+			    tree spacing = gfc_conv_descriptor_spacing_get (info->descriptor,
+									    gfc_rank_cst[n]);
+			    info->spacing[n] = gfc_evaluate_now (spacing, &outer_loop->pre);
+			  }
+		      }
+		    else
 		      {
-			info->spacing[n] = spacing;
+			tree spacing = fold_convert_loc (input_location,
+							 gfc_array_index_type, 
+							 TYPE_SIZE_UNIT (type));
+			spacing = gfc_evaluate_now (spacing, &outer_loop->pre);
 
-			tree extent = gfc_conv_descriptor_extent_get (info->descriptor,
-								      gfc_rank_cst[n]);
+			for (n = 0; n < ss_info->expr->rank; n++)
+			  {
+			    info->spacing[n] = spacing;
 
-			spacing = fold_build2_loc (input_location, MULT_EXPR,
-						   gfc_array_index_type, spacing,
-						   extent);
-			spacing = gfc_evaluate_now (spacing, &outer_loop->pre);
+			    tree extent = gfc_conv_descriptor_extent_get (info->descriptor,
+									  gfc_rank_cst[n]);
+
+			    spacing = fold_build2_loc (input_location, MULT_EXPR,
+						       gfc_array_index_type, spacing,
+						       extent);
+			    spacing = gfc_evaluate_now (spacing, &outer_loop->pre);
+			  }
 		      }
 		  }
 	      }


More information about the Gcc-cvs mailing list