https://gcc.gnu.org/g:76912b6e28682c56a2743e190f1485c970bcb4f3
commit 76912b6e28682c56a2743e190f1485c970bcb4f3 Author: Mikael Morin <[email protected]> Date: Tue Sep 16 18:50:18 2025 +0200 Déplacement accumulation index dans conv_array_index_offset Revert partiel "Déplacement accumulation index dans conv_array_index_offset" This reverts commit f1ebc346ac933408ceea78965303282d11859e1d. Diff: --- gcc/fortran/trans-array.cc | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 935c2cca3f3b..83f1091b64cc 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -3564,7 +3564,10 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i, index = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, index, stride); - return index; + /* Add the offset for this dimension to the stored offset for all other + dimensions. */ + return fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, + info->element_ref.index, index); } @@ -3708,11 +3711,6 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar, n = 0; index = conv_array_index_offset (se, ss, ss->dim[n], n, ar, info->stride0); - /* Add the offset for this dimension to the stored offset for all other - dimensions. */ - if (info->element_ref.index && !integer_zerop (info->element_ref.index)) - index = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - index, info->element_ref.index); base = build_fold_indirect_ref_loc (input_location, info->element_ref.base); @@ -4018,7 +4016,8 @@ add_array_offset (stmtblock_t *pblock, gfc_loopinfo *loop, gfc_ss *ss, { gfc_se se; gfc_array_info *info; - tree stride, index; + tree stride; + tree index; info = &ss->info->data.array; @@ -4029,10 +4028,7 @@ add_array_offset (stmtblock_t *pblock, gfc_loopinfo *loop, gfc_ss *ss, index = conv_array_index_offset (&se, ss, array_dim, loop_dim, ar, stride); gfc_add_block_to_block (pblock, &se.pre); - info->element_ref.index = fold_build2_loc (input_location, PLUS_EXPR, - gfc_array_index_type, - info->element_ref.index, index); - info->element_ref.index = gfc_evaluate_now (info->element_ref.index, pblock); + info->element_ref.index = gfc_evaluate_now (index, pblock); }
