https://gcc.gnu.org/g:c4063c86469203a049f91645fa91e49eea73c694
commit c4063c86469203a049f91645fa91e49eea73c694 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Fri Aug 15 17:56:25 2025 +0200 Correction renseignement stride Diff: --- gcc/fortran/trans-descriptor.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index f020a6f0bcc7..f91752047fad 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -2006,16 +2006,17 @@ set_gfc_dimension_from_cfi (stmtblock_t *block, tree gfc, tree cfi, tree idx, bool contiguous) { /* gfc->dim[i].lbound = ... */ + lbound = gfc_evaluate_now (lbound, block); gfc_conv_descriptor_lbound_set (block, gfc, idx, lbound); /* gfc->dim[i].ubound = gfc->dim[i].lbound + cfi->dim[i].extent - 1. */ tree tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - gfc_conv_descriptor_lbound_get (gfc, idx), - gfc_index_one_node); + lbound, gfc_index_one_node); tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, gfc_get_cfi_dim_extent (cfi, idx), tmp); gfc_conv_descriptor_ubound_set (block, gfc, idx, tmp); + tree stride; if (contiguous) { /* gfc->dim[i].stride @@ -2029,7 +2030,8 @@ set_gfc_dimension_from_cfi (stmtblock_t *block, tree gfc, tree cfi, tree idx, tmp, cont_stride_var); tmp = build3_loc (input_location, COND_EXPR, gfc_array_index_type, cond, gfc_index_one_node, tmp); - gfc_add_modify (block, cont_stride_var, tmp); + stride = gfc_evaluate_now (tmp, block); + gfc_add_modify (block, cont_stride_var, stride); } else { @@ -2039,13 +2041,13 @@ set_gfc_dimension_from_cfi (stmtblock_t *block, tree gfc, tree cfi, tree idx, gfc_array_index_type, tmp, fold_convert (gfc_array_index_type, gfc_get_cfi_desc_elem_len (cfi))); + stride = gfc_evaluate_now (tmp, block); } - gfc_conv_descriptor_stride_set (block, gfc, idx, tmp); + gfc_conv_descriptor_stride_set (block, gfc, idx, stride); /* gfc->offset -= gfc->dim[i].stride * gfc->dim[i].lbound. */ tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, - gfc_conv_descriptor_stride_get (gfc, idx), - gfc_conv_descriptor_lbound_get (gfc, idx)); + stride, lbound); tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, offset_var, tmp); gfc_add_modify (block, offset_var, tmp);