https://gcc.gnu.org/g:be2ede1661a00d5a4a72631c9d23a3dd6deefe18
commit be2ede1661a00d5a4a72631c9d23a3dd6deefe18 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Thu Aug 14 10:57:25 2025 +0200 Sauvegarde compil' OK Diff: --- gcc/fortran/trans-descriptor.cc | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index 5791765e44b1..2e05ad7bd8b3 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -1220,6 +1220,9 @@ shift_dimension_bounds (stmtblock_t * block, tree descr, tree dim, tree orig_stride, tree *offset_value) { new_lbound = fold_convert (gfc_array_index_type, new_lbound); + new_lbound = gfc_evaluate_now (new_lbound, block); + + orig_stride = gfc_evaluate_now (orig_stride, block); /* Get difference (new - old) by which to shift stuff. */ tree diff = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, @@ -1231,11 +1234,9 @@ shift_dimension_bounds (stmtblock_t * block, tree descr, tree dim, gfc_array_index_type, orig_ubound, diff); gfc_conv_descriptor_ubound_set (block, descr, dim, ubound); tree tmp = fold_build2_loc (input_location, MULT_EXPR, - gfc_array_index_type, diff, orig_stride); - tree off = fold_build2_loc (input_location, MINUS_EXPR, - gfc_array_index_type, *offset_value, - tmp); - *offset_value = gfc_evaluate_now (off, block); + gfc_array_index_type, new_lbound, orig_stride); + *offset_value = fold_build2_loc (input_location, MINUS_EXPR, + gfc_array_index_type, *offset_value, tmp); /* Finally set lbound to value we want. */ gfc_conv_descriptor_lbound_set (block, descr, dim, new_lbound); @@ -1246,21 +1247,19 @@ shift_dimension_bounds (stmtblock_t * block, tree descr, tree dim, specified. This also updates ubound and offset accordingly. */ void -gfc_conv_shift_descriptor_lbound (stmtblock_t* block, tree desc, - int dim, tree new_lbound) +conv_shift_descriptor_lbound (stmtblock_t* block, tree desc, + int dim, tree new_lbound, tree *offset) { - tree offs, ubound, lbound, stride; + tree ubound, lbound, stride; new_lbound = fold_convert (gfc_array_index_type, new_lbound); - offs = gfc_conv_descriptor_offset_get (desc); lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim]); ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[dim]); stride = gfc_conv_descriptor_stride_get (desc, gfc_rank_cst[dim]); shift_dimension_bounds (block, desc, gfc_rank_cst[dim], new_lbound, lbound, - ubound, stride, &offs); - gfc_conv_descriptor_offset_set (block, desc, offs); + ubound, stride, offset); } @@ -1268,9 +1267,11 @@ void gfc_conv_shift_descriptor (stmtblock_t* block, tree desc, int rank) { /* Apply a shift of the lbound when supplied. */ + tree offset = gfc_index_zero_node; for (int dim = 0; dim < rank; ++dim) - gfc_conv_shift_descriptor_lbound (block, desc, dim, - gfc_index_one_node); + conv_shift_descriptor_lbound (block, desc, dim, gfc_index_one_node, + &offset); + gfc_conv_descriptor_offset_set (block, desc, offset); } @@ -1279,6 +1280,7 @@ conv_shift_descriptor (stmtblock_t *block, tree desc, int rank, gfc_expr * const (lbound[GFC_MAX_DIMENSIONS])) { /* Apply a shift of the lbound when supplied. */ + tree offset = gfc_index_zero_node; for (int dim = 0; dim < rank; ++dim) { gfc_expr *lb_expr = lbound[dim]; @@ -1301,8 +1303,9 @@ conv_shift_descriptor (stmtblock_t *block, tree desc, int rank, lower_bound = lb_var; } - gfc_conv_shift_descriptor_lbound (block, desc, dim, lower_bound); + conv_shift_descriptor_lbound (block, desc, dim, lower_bound, &offset); } + gfc_conv_descriptor_offset_set (block, desc, offset); } @@ -1384,14 +1387,12 @@ gfc_conv_shift_descriptor (stmtblock_t *block, tree dest, tree src, tree dim = gfc_rank_cst[n]; tree stride = gfc_conv_descriptor_stride_get (src, dim); - shift_dimension_bounds (block, dest, gfc_rank_cst[n], lbound, - gfc_index_zero_node, + shift_dimension_bounds (block, dest, gfc_rank_cst[n], + lbound, gfc_index_zero_node, gfc_conv_descriptor_ubound_get (src, dim), stride, &offset); gfc_conv_descriptor_stride_set (block, dest, dim, stride); - - offset = gfc_evaluate_now (offset, block); } gfc_conv_descriptor_offset_set (block, dest, offset); @@ -1454,7 +1455,6 @@ gfc_set_subarray_descriptor (stmtblock_t *block, tree descr, tree value, gfc_conv_descriptor_ubound_get (descr, dim), gfc_conv_descriptor_stride_get (descr, dim), &offset); - offset = gfc_evaluate_now (offset, block); } gfc_conv_descriptor_offset_set (block, descr, offset); } @@ -1473,8 +1473,6 @@ gfc_shift_descriptor (stmtblock_t *block, tree descr, int rank, shift_dimension_bounds (block, descr, dim, gfc_index_one_node, lbound[n], ubound[n], size, &offset); - size = gfc_evaluate_now (size, block); - offset = gfc_evaluate_now (offset, block); tree tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, ubound[n], lbound[n]); tmp = fold_build2_loc (input_location, PLUS_EXPR,