https://gcc.gnu.org/g:145c92e13ce19f727997226fcc5ac8fd48f71ec2
commit 145c92e13ce19f727997226fcc5ac8fd48f71ec2 Author: Mikael Morin <[email protected]> Date: Tue Sep 16 11:25:02 2025 +0200 Factorisation build_spanned_array_ref Diff: --- gcc/fortran/trans.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/gcc/fortran/trans.cc b/gcc/fortran/trans.cc index 66c0bf28f06b..76ddffc36dec 100644 --- a/gcc/fortran/trans.cc +++ b/gcc/fortran/trans.cc @@ -557,16 +557,7 @@ gfc_build_array_ref (tree base, tree offset, bool non_negative_offset, tree elt_size = fold_convert (gfc_array_index_type, TYPE_SIZE_UNIT (type)); - tree offset_bytes = fold_build2_loc (input_location, MULT_EXPR, - gfc_array_index_type, - zero_based_index, elt_size); - - tree base_addr = gfc_build_addr_expr (pvoid_type_node, base); - - tree ptr = fold_build_pointer_plus_loc (input_location, base_addr, - offset_bytes); - return build1_loc (input_location, INDIRECT_REF, type, - fold_convert (build_pointer_type (type), ptr)); + return build_spanned_array_ref (base, zero_based_index, elt_size); } }
