https://gcc.gnu.org/g:a2676a32c366dff255672d61bdfc8ce3dea3e79c
commit a2676a32c366dff255672d61bdfc8ce3dea3e79c Author: Mikael Morin <mik...@gcc.gnu.org> Date: Wed Apr 23 21:39:04 2025 +0200 Correction régression pr104330 Diff: --- gcc/fortran/trans-intrinsic.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index 475fa096ea4b..43e3ebff3bee 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -2154,8 +2154,8 @@ trans_image_index (gfc_se * se, gfc_expr *expr) thus we need explicitly check this - and return 0 if they are exceeded. */ lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[rank+corank-1]); - tmp = gfc_build_array_ref (subdesc, gfc_rank_cst[corank-1], false, - NULL_TREE, GFC_TYPE_ARRAY_SPACING (subse.expr, 0)); + tmp = gfc_build_array_ref (subdesc, gfc_rank_cst[corank-1], false, NULL_TREE, + GFC_TYPE_ARRAY_SPACING (TREE_TYPE (subse.expr), 0)); invalid_bound = fold_build2_loc (input_location, LT_EXPR, logical_type_node, fold_convert (gfc_array_index_type, tmp), lbound); @@ -2166,7 +2166,8 @@ trans_image_index (gfc_se * se, gfc_expr *expr) ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[codim]); tmp = gfc_build_array_ref (subdesc, gfc_rank_cst[codim-rank], false, NULL_TREE, - GFC_TYPE_ARRAY_SPACING (subse.expr, 0)); + GFC_TYPE_ARRAY_SPACING (TREE_TYPE (subse.expr), + 0)); cond = fold_build2_loc (input_location, LT_EXPR, logical_type_node, fold_convert (gfc_array_index_type, tmp), lbound); @@ -2185,9 +2186,9 @@ trans_image_index (gfc_se * se, gfc_expr *expr) /* coindex = sub(corank) - lcobound(n). */ coindex = fold_convert (gfc_array_index_type, - gfc_build_array_ref (subdesc, gfc_rank_cst[corank-1], - false, NULL_TREE, - GFC_TYPE_ARRAY_SPACING (subse.expr, 0))); + gfc_build_array_ref (subdesc, gfc_rank_cst[corank-1], + false, NULL_TREE, + GFC_TYPE_ARRAY_SPACING (TREE_TYPE (subse.expr), 0))); lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[rank+corank-1]); coindex = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, fold_convert (gfc_array_index_type, coindex), @@ -2206,8 +2207,8 @@ trans_image_index (gfc_se * se, gfc_expr *expr) /* coindex += sub(codim). */ tmp = gfc_build_array_ref (subdesc, gfc_rank_cst[codim-rank], false, - NULL_TREE, - GFC_TYPE_ARRAY_SPACING (subse.expr, 0)); + NULL_TREE, + GFC_TYPE_ARRAY_SPACING (TREE_TYPE (subse.expr), 0)); coindex = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, coindex, fold_convert (gfc_array_index_type, tmp));