https://gcc.gnu.org/g:3a432b11ac97ca20fd49a0bcddb4a82cb4011750
commit 3a432b11ac97ca20fd49a0bcddb4a82cb4011750 Author: Mikael Morin <mik...@gcc.gnu.org> Date: Thu May 15 17:09:34 2025 +0200 Correction régression bind_c_char_9 Diff: --- gcc/fortran/trans-array.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 6501adcb66d4..415d353b1394 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -6299,6 +6299,18 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_add_block_to_block (pblock, &se.finalblock); gfc_add_modify (pblock, lbound, se.expr); } + /* The offset of this dimension. offset = offset - lbound * sm. */ + tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, + lbound, spacing); + offset = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, + offset, tmp); + if (as->type == AS_ASSUMED_SIZE + && dim == as->rank - 1) + { + size = NULL_TREE; + break; + } + ubound = GFC_TYPE_ARRAY_UBOUND (type, dim); if (as->upper[dim] && !INTEGER_CST_P (ubound)) { @@ -6308,11 +6320,6 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_add_block_to_block (pblock, &se.finalblock); gfc_add_modify (pblock, ubound, se.expr); } - /* The offset of this dimension. offset = offset - lbound * sm. */ - tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, - lbound, spacing); - offset = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - offset, tmp); /* Calculate spacing = size * (ubound + 1 - lbound). */ tmp = gfc_conv_array_extent_dim (lbound, ubound, nullptr);