https://gcc.gnu.org/g:173deb40c505b06796a1c223ce7a33e21968d3a9
commit 173deb40c505b06796a1c223ce7a33e21968d3a9 Author: Mikael Morin <[email protected]> Date: Sat Sep 6 16:34:11 2025 +0200 Introduction gfc_conv_descriptor_extent_get Modif implémentation descriptor_extent_get Correction motif bind_c_array_params_2 Ajout motif dump coarray_lock_7 Correction dump intrinsic_size_3 Mise à jour motif dump pr48636 Correction motif dump intrinsic_size_3 Correction motif dump bind_c_array_params_2 Correction motif dump coarray_lock_7 Diff: --- gcc/fortran/trans-array.cc | 20 ++----------- gcc/fortran/trans-decl.cc | 6 +--- gcc/fortran/trans-descriptor.cc | 34 +++++++++++----------- gcc/fortran/trans-descriptor.h | 1 + gcc/fortran/trans-expr.cc | 9 ++---- gcc/fortran/trans-intrinsic.cc | 30 +++++-------------- gcc/fortran/trans-openmp.cc | 34 ++++------------------ gcc/fortran/trans-stmt.cc | 10 +++---- .../gfortran.dg/bind_c_array_params_2.f90 | 2 +- gcc/testsuite/gfortran.dg/coarray_lock_7.f90 | 4 +-- gcc/testsuite/gfortran.dg/intrinsic_size_3.f90 | 2 +- gcc/testsuite/gfortran.dg/pr48636.f90 | 2 +- 12 files changed, 46 insertions(+), 108 deletions(-) diff --git a/gcc/fortran/trans-array.cc b/gcc/fortran/trans-array.cc index 9441dea32385..db96eb605831 100644 --- a/gcc/fortran/trans-array.cc +++ b/gcc/fortran/trans-array.cc @@ -7972,13 +7972,8 @@ gfc_tree_array_size (stmtblock_t *block, tree desc, gfc_expr *expr, tree dim) { if (!dim) dim = gfc_index_zero_node; - tree ubound = gfc_conv_descriptor_ubound_get (desc, dim); - tree lbound = gfc_conv_descriptor_lbound_get (desc, dim); - size = fold_build2_loc (input_location, MINUS_EXPR, - gfc_array_index_type, ubound, lbound); - size = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - size, gfc_index_one_node); + size = gfc_conv_descriptor_extent_get (desc, dim); /* if (!allocatable && !pointer && assumed rank) size = (idx == rank && ubound[rank-1] == -1 ? -1 : size; else @@ -8039,11 +8034,7 @@ gfc_tree_array_size (stmtblock_t *block, tree desc, gfc_expr *expr, tree dim) cond = fold_build2_loc (input_location, TRUTH_AND_EXPR, boolean_type_node, cond, tmp); } - tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - gfc_conv_descriptor_ubound_get (desc, idx), - gfc_conv_descriptor_lbound_get (desc, idx)); - tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - tmp, gfc_index_one_node); + tmp = gfc_conv_descriptor_extent_get (desc, idx); gfc_add_modify (&cond_block, extent, tmp); tmp = fold_build2_loc (input_location, LT_EXPR, boolean_type_node, extent, gfc_index_zero_node); @@ -8619,12 +8610,7 @@ gfc_full_array_size (stmtblock_t *block, tree decl, int rank) idx = gfc_conv_descriptor_rank_get (decl); else idx = gfc_rank_cst[rank - 1]; - nelems = gfc_conv_descriptor_ubound_get (decl, idx); - tmp = gfc_conv_descriptor_lbound_get (decl, idx); - tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - nelems, tmp); - tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - tmp, gfc_index_one_node); + tmp = gfc_conv_descriptor_extent_get (decl, idx); tmp = gfc_evaluate_now (tmp, block); nelems = gfc_conv_descriptor_stride_get (decl, idx); diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index f6ea30b4f8de..9ee0b630bd41 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -7680,11 +7680,7 @@ done: gfc_add_modify (&loop_body, gfc_get_cfi_dim_lbound (cfi, idx), gfc_conv_descriptor_lbound_get (gfc_desc, idx)); /* cfi->dim[i].extent = gfc->dim[i].ubound - gfc->dim[i].lbound + 1. */ - tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - gfc_conv_descriptor_ubound_get (gfc_desc, idx), - gfc_conv_descriptor_lbound_get (gfc_desc, idx)); - tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, tmp, - gfc_index_one_node); + tmp = gfc_conv_descriptor_extent_get (gfc_desc, idx); gfc_add_modify (&loop_body, gfc_get_cfi_dim_extent (cfi, idx), tmp); /* d->dim[n].sm = gfc->dim[i].stride * gfc->span); */ tmp = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, diff --git a/gcc/fortran/trans-descriptor.cc b/gcc/fortran/trans-descriptor.cc index b0f162be6cc8..11183cbd59f1 100644 --- a/gcc/fortran/trans-descriptor.cc +++ b/gcc/fortran/trans-descriptor.cc @@ -594,6 +594,20 @@ gfc_conv_descriptor_sm_get (tree desc, tree dim) gfc_conv_descriptor_span_get (desc)); } + +tree +gfc_conv_descriptor_extent_get (tree desc, tree dim) +{ + tree lbound = gfc_conv_descriptor_lbound_get (desc, dim); + tree ubound = gfc_conv_descriptor_ubound_get (desc, dim); + + tree tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, + lbound, gfc_index_one_node); + return fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, + ubound, tmp); +} + + /******************************************************************************* * Array descriptor higher level routines. * ******************************************************************************/ @@ -1044,14 +1058,7 @@ gfc_conv_descriptor_size_1 (tree desc, int from_dim, int to_dim) for (dim = from_dim; dim < to_dim; ++dim) { - tree lbound; - tree ubound; - tree extent; - - lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[dim]); - ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[dim]); - - extent = gfc_conv_array_extent_dim (lbound, ubound, NULL); + tree extent = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[dim]); res = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, res, extent); } @@ -2844,15 +2851,8 @@ gfc_descriptor_init_count (tree descriptor, int rank, int corank, start at zero, but when allocating it, the standard expects the array to start at one. Therefore fix the upper bound to be (desc.ubound - desc.lbound) + 1. */ - tmp = fold_build2_loc (input_location, MINUS_EXPR, - gfc_array_index_type, - gfc_conv_descriptor_ubound_get ( - expr3_desc, gfc_rank_cst[n]), - gfc_conv_descriptor_lbound_get ( - expr3_desc, gfc_rank_cst[n])); - tmp = fold_build2_loc (input_location, PLUS_EXPR, - gfc_array_index_type, tmp, - gfc_index_one_node); + tmp = gfc_conv_descriptor_extent_get (expr3_desc, + gfc_rank_cst[n]); se.expr = gfc_evaluate_now (tmp, pblock); } else diff --git a/gcc/fortran/trans-descriptor.h b/gcc/fortran/trans-descriptor.h index 52ac158993fb..52762c3c94a4 100644 --- a/gcc/fortran/trans-descriptor.h +++ b/gcc/fortran/trans-descriptor.h @@ -58,6 +58,7 @@ tree gfc_conv_descriptor_stride_get (tree desc, tree dim); tree gfc_conv_descriptor_lbound_get (tree desc, tree dim); tree gfc_conv_descriptor_ubound_get (tree desc, tree dim); tree gfc_conv_descriptor_sm_get (tree desc, tree dim); +tree gfc_conv_descriptor_extent_get (tree desc, tree dim); void gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value); void gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value); diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc index 56776776fa98..156dc5de04ac 100644 --- a/gcc/fortran/trans-expr.cc +++ b/gcc/fortran/trans-expr.cc @@ -2540,8 +2540,7 @@ gfc_caf_get_image_index (stmtblock_t *block, gfc_expr *e, tree desc) TREE_TYPE (tmp), img_idx, tmp); if (i < ref->u.ar.dimen + ref->u.ar.codimen - 1) { - ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[i]); - tmp = gfc_conv_array_extent_dim (lbound, ubound, NULL); + tmp = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[i]); extent = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (tmp), extent, tmp); } @@ -6228,11 +6227,7 @@ gfc_conv_gfc_desc_to_cfi_desc (gfc_se *parmse, gfc_expr *e, gfc_symbol *fsym) tmp = gfc_index_zero_node; gfc_add_modify (&loop_body, gfc_get_cfi_dim_lbound (cfi, idx), tmp); /* cfi->dim[i].extent = gfc->dim[i].ubound - gfc->dim[i].lbound + 1. */ - tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - gfc_conv_descriptor_ubound_get (gfc, idx), - gfc_conv_descriptor_lbound_get (gfc, idx)); - tmp = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - tmp, gfc_index_one_node); + tmp = gfc_conv_descriptor_extent_get (gfc, idx); gfc_add_modify (&loop_body, gfc_get_cfi_dim_extent (cfi, idx), tmp); /* d->dim[n].sm = gfc->dim[i].stride * gfc->span); */ tmp = gfc_conv_descriptor_sm_get (gfc, idx); diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc index 2787a7d07640..88b8b17892dc 100644 --- a/gcc/fortran/trans-intrinsic.cc +++ b/gcc/fortran/trans-intrinsic.cc @@ -1825,7 +1825,7 @@ trans_this_image (gfc_se * se, gfc_expr *expr) { stmtblock_t loop; tree type, desc, dim_arg, cond, tmp, m, loop_var, exit_label, min_var, lbound, - ubound, extent, ml, team; + extent, ml, team; gfc_se argse; int rank, corank; @@ -1991,9 +1991,7 @@ trans_this_image (gfc_se * se, gfc_expr *expr) gfc_add_modify (&loop, ml, m); /* extent = ... */ - lbound = gfc_conv_descriptor_lbound_get (desc, loop_var); - ubound = gfc_conv_descriptor_ubound_get (desc, loop_var); - extent = gfc_conv_array_extent_dim (lbound, ubound, NULL); + extent = gfc_conv_descriptor_extent_get (desc, loop_var); extent = fold_convert (type, extent); /* m = m/extent. */ @@ -2200,12 +2198,10 @@ trans_image_index (gfc_se * se, gfc_expr *expr) for (codim = corank + rank - 2; codim >= rank; codim--) { - tree extent, ubound; + tree extent; /* coindex = coindex*extent(codim) + sub(codim) - lcobound(codim). */ - lbound = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[codim]); - ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[codim]); - extent = gfc_conv_array_extent_dim (lbound, ubound, NULL); + extent = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[codim]); /* coindex *= extent. */ coindex = fold_build2_loc (input_location, MULT_EXPR, @@ -2357,13 +2353,7 @@ gfc_conv_is_contiguous_expr (gfc_se *se, gfc_expr *arg) for (i = 0; i < arg->rank - 1; i++) { - tmp = gfc_conv_descriptor_lbound_get (desc, gfc_rank_cst[i]); - extent = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[i]); - extent = fold_build2_loc (input_location, MINUS_EXPR, - gfc_array_index_type, extent, tmp); - extent = fold_build2_loc (input_location, PLUS_EXPR, - gfc_array_index_type, extent, - gfc_index_one_node); + extent = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[i]); tmp = gfc_conv_descriptor_stride_get (desc, gfc_rank_cst[i]); tmp = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (tmp), tmp, extent); @@ -2483,10 +2473,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, enum gfc_isym_id op) ubound = gfc_conv_descriptor_ubound_get (desc, bound); lbound = gfc_conv_descriptor_lbound_get (desc, bound); - size = fold_build2_loc (input_location, MINUS_EXPR, - gfc_array_index_type, ubound, lbound); - size = fold_build2_loc (input_location, PLUS_EXPR, - gfc_array_index_type, size, gfc_index_one_node); + size = gfc_conv_descriptor_extent_get (desc, bound); /* 13.14.53: Result value for LBOUND @@ -12831,7 +12818,7 @@ conv_intrinsic_event_query (gfc_code *code) /* For arrays, obtain the array index. */ if (gfc_expr_attr (event_expr).dimension) { - tree desc, tmp, extent, lbound, ubound; + tree desc, tmp, extent, lbound; gfc_array_ref *ar, ar2; int i; @@ -12864,8 +12851,7 @@ conv_intrinsic_event_query (gfc_code *code) TREE_TYPE (tmp), index, tmp); if (i < ar->dimen - 1) { - ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[i]); - tmp = gfc_conv_array_extent_dim (lbound, ubound, NULL); + tmp = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[i]); extent = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (tmp), extent, tmp); } diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 0b5ea14629a9..07e3649914fb 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -829,12 +829,7 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) { gfc_add_modify (&cond_block, decl, outer); tree rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; - size = gfc_conv_descriptor_ubound_get (decl, rank); - size = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - size, - gfc_conv_descriptor_lbound_get (decl, rank)); - size = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - size, gfc_index_one_node); + size = gfc_conv_descriptor_extent_get (decl, rank); if (GFC_TYPE_ARRAY_RANK (type) > 1) size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, size, @@ -1020,12 +1015,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) if (GFC_DESCRIPTOR_TYPE_P (type)) { tree rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; - size = gfc_conv_descriptor_ubound_get (dest, rank); - size = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - size, - gfc_conv_descriptor_lbound_get (dest, rank)); - size = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - size, gfc_index_one_node); + size = gfc_conv_descriptor_extent_get (dest, rank); if (GFC_TYPE_ARRAY_RANK (type) > 1) size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, size, @@ -1143,12 +1133,7 @@ gfc_omp_clause_assign_op (tree clause, tree dest, tree src) if (GFC_DESCRIPTOR_TYPE_P (type)) { tree rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; - size = gfc_conv_descriptor_ubound_get (src, rank); - size = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - size, - gfc_conv_descriptor_lbound_get (src, rank)); - size = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - size, gfc_index_one_node); + size = gfc_conv_descriptor_extent_get (src, rank); if (GFC_TYPE_ARRAY_RANK (type) > 1) size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, size, @@ -1374,12 +1359,7 @@ gfc_omp_clause_linear_ctor (tree clause, tree dest, tree src, tree add) if (GFC_DESCRIPTOR_TYPE_P (type)) { tree rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; - size = gfc_conv_descriptor_ubound_get (dest, rank); - size = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, - size, - gfc_conv_descriptor_lbound_get (dest, rank)); - size = fold_build2_loc (input_location, PLUS_EXPR, gfc_array_index_type, - size, gfc_index_one_node); + size = gfc_conv_descriptor_extent_get (dest, rank); if (GFC_TYPE_ARRAY_RANK (type) > 1) size = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, size, @@ -2058,11 +2038,7 @@ gfc_omp_get_array_size (location_t loc, tree desc, gimple_seq *seq) gfc_omp_gen_simple_loop (idx, begin, end, LT_EXPR, step, loc, &seq1, &seq2); gimple_seq_add_seq (seq, seq1); - tmp = fold_build2_loc (loc, MINUS_EXPR, gfc_array_index_type, - gfc_conv_descriptor_ubound_get (desc, idx), - gfc_conv_descriptor_lbound_get (desc, idx)); - tmp = fold_build2_loc (loc, PLUS_EXPR, gfc_array_index_type, - tmp, gfc_index_one_node); + tmp = gfc_conv_descriptor_extent_get (desc, idx); gimplify_assign (extent, tmp, seq); tmp = fold_build2_loc (loc, LT_EXPR, boolean_type_node, extent, gfc_index_zero_node); diff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc index 414fa1dbdafc..c9b0692dbfb8 100644 --- a/gcc/fortran/trans-stmt.cc +++ b/gcc/fortran/trans-stmt.cc @@ -1049,7 +1049,7 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op) /* For arrays, obtain the array index. */ if (gfc_expr_attr (code->expr1).dimension) { - tree desc, tmp, extent, lbound, ubound; + tree desc, tmp, extent, lbound; gfc_array_ref *ar, ar2; int i, rank; @@ -1085,8 +1085,7 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op op) TREE_TYPE (tmp), index, tmp); if (i < ar->dimen - 1) { - ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[i]); - tmp = gfc_conv_array_extent_dim (lbound, ubound, NULL); + tmp = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[i]); extent = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (tmp), extent, tmp); } @@ -1250,7 +1249,7 @@ gfc_trans_event_post_wait (gfc_code *code, gfc_exec_op op) /* For arrays, obtain the array index. */ if (gfc_expr_attr (code->expr1).dimension) { - tree desc, tmp, extent, lbound, ubound; + tree desc, tmp, extent, lbound; gfc_array_ref *ar, ar2; int i; @@ -1283,8 +1282,7 @@ gfc_trans_event_post_wait (gfc_code *code, gfc_exec_op op) TREE_TYPE (tmp), index, tmp); if (i < ar->dimen - 1) { - ubound = gfc_conv_descriptor_ubound_get (desc, gfc_rank_cst[i]); - tmp = gfc_conv_array_extent_dim (lbound, ubound, NULL); + tmp = gfc_conv_descriptor_extent_get (desc, gfc_rank_cst[i]); extent = fold_build2_loc (input_location, MULT_EXPR, TREE_TYPE (tmp), extent, tmp); } diff --git a/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 b/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 index 7d79d9b44ac0..ca2667f8c69c 100644 --- a/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 +++ b/gcc/testsuite/gfortran.dg/bind_c_array_params_2.f90 @@ -46,7 +46,7 @@ end ! { dg-final { scan-tree-dump "if \\(idx.. <= 1\\) goto L..;" "original" } } ! { dg-final { scan-tree-dump "cfi...dim\\\[idx..\\\].lower_bound = 0;" "original" } } -! { dg-final { scan-tree-dump {cfi..\.dim\[idx..\].extent = \((?:NON_LVALUE_EXPR <)?parm..\.dim\[idx..\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm..\.dim\[idx..\]\.lbound>?\) \+ 1;} "original" } } +! { dg-final { scan-tree-dump {cfi..\.dim\[idx..\].extent = (?:NON_LVALUE_EXPR <)?parm..\.dim\[idx..\]\.ubound>? - \((?:NON_LVALUE_EXPR <)?parm..\.dim\[idx..\]\.lbound>? \+ -1\);} "original" } } ! { dg-final { scan-tree-dump {cfi..\.dim\[idx..\].sm = (?:NON_LVALUE_EXPR <)?parm...dim\[idx..\].stride>? \* (?:NON_LVALUE_EXPR <)?parm..\.span>?;} "original" } } ! { dg-final { scan-tree-dump "idx.. = idx.. \\+ 1;" "original" } } diff --git a/gcc/testsuite/gfortran.dg/coarray_lock_7.f90 b/gcc/testsuite/gfortran.dg/coarray_lock_7.f90 index b7b0409c1099..a6ea748fbee8 100644 --- a/gcc/testsuite/gfortran.dg/coarray_lock_7.f90 +++ b/gcc/testsuite/gfortran.dg/coarray_lock_7.f90 @@ -35,8 +35,8 @@ end ! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(caf_token.., 0, 0, 0B, 0B, 0B, 0\\);" 1 "original" } } ! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(caf_token.., 0, 0, 0B, 0B, 0\\);" 1 "original" } } -! { dg-final { scan-tree-dump-times {_gfortran_caf_lock \(caf_token.., .*\(\(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \(\((?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ 1\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, 0B, &ii, 0B, 0\);|_gfortran_caf_lock \(caf_token.1, \(.*?\) \(\(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \(MAX_EXPR <(?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?, -1> \+ 1\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, 0B, &ii, 0B, 0\);} 1 "original" } } -! { dg-final { scan-tree-dump-times {_gfortran_caf_unlock \(caf_token.., .*\(\(2 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \(\(parm.\d+\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ 1\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, &ii, 0B, 0\);|_gfortran_caf_unlock \(caf_token.., \(.*?\) \(\(2 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \(MAX_EXPR <(?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?, -1> \+ 1\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, &ii, 0B, 0\);} 1 "original" } } +! { dg-final { scan-tree-dump-times {_gfortran_caf_lock \(caf_token.., .*\(\(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \((?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - \((?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>? \+ -1\)\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, 0B, &ii, 0B, 0\);|_gfortran_caf_lock \(caf_token.1, \(.*?\) \(\(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \(MAX_EXPR <(?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?, -1> \+ 1\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, 0B, &ii, 0B, 0\);} 1 "original" } } +! { dg-final { scan-tree-dump-times {_gfortran_caf_unlock \(caf_token.., .*\(\(2 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \((?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - \((?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>? \+ -1\)\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, &ii, 0B, 0\);|_gfortran_caf_unlock \(caf_token.., \(.*?\) \(\(2 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?\) \+ \(MAX_EXPR <(?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[0\]\.lbound>?, -1> \+ 1\) \* \(3 - (?:NON_LVALUE_EXPR <)?parm.\d+\.dim\[1\]\.lbound>?\)\), 0, &ii, 0B, 0\);} 1 "original" } } ! { dg-final { scan-tree-dump-times {_gfortran_caf_lock \((?:NON_LVALUE_EXPR <)?three.token>?, 0, \(integer\(kind=4\)\) \(5 - (?:NON_LVALUE_EXPR <)?three.dim\[0\].lbound>?\), &acquired.[0-9]+, 0B, 0B, 0\);|_gfortran_caf_lock \((?:NON_LVALUE_EXPR <)?three.token>?, 0, 5 - (?:NON_LVALUE_EXPR <)?three.dim\[0\].lbound>?, &acquired.[0-9]+, 0B, 0B, 0\);} 1 "original" } } ! { dg-final { scan-tree-dump-times {_gfortran_caf_unlock \((?:NON_LVALUE_EXPR <)?three.token>?, 0, \(integer\(kind=4\)\) \(8 - (?:NON_LVALUE_EXPR <)?three.dim\[0\].lbound>?\), &ii, 0B, 0\);|_gfortran_caf_unlock \((?:NON_LVALUE_EXPR <)?three.token>?, 0, 8 - (?:NON_LVALUE_EXPR <)?three.dim\[0\].lbound>?, &ii, 0B, 0\);} 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/intrinsic_size_3.f90 b/gcc/testsuite/gfortran.dg/intrinsic_size_3.f90 index 593296c0a7e6..6a9206a8a899 100644 --- a/gcc/testsuite/gfortran.dg/intrinsic_size_3.f90 +++ b/gcc/testsuite/gfortran.dg/intrinsic_size_3.f90 @@ -22,4 +22,4 @@ program bug stop end program bug -! { dg-final { scan-tree-dump-times {iszs = \(integer\(kind=2\)\) MAX_EXPR <\((?:NON_LVALUE_EXPR <)?a\.dim\[0\]\.ubound>? - (?:NON_LVALUE_EXPR <)?a\.dim\[0\]\.lbound>?\) \+ 1, 0>;} 1 "original" } } +! { dg-final { scan-tree-dump-times {iszs = \(integer\(kind=2\)\) MAX_EXPR <(?:NON_LVALUE_EXPR <)?a\.dim\[0\]\.ubound>? - \((?:NON_LVALUE_EXPR <)?a\.dim\[0\]\.lbound>? \+ -1\), 0>;} 1 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pr48636.f90 b/gcc/testsuite/gfortran.dg/pr48636.f90 index cb5b4d7a553a..0e265e5955b5 100644 --- a/gcc/testsuite/gfortran.dg/pr48636.f90 +++ b/gcc/testsuite/gfortran.dg/pr48636.f90 @@ -34,5 +34,5 @@ program main end program main ! { dg-final { scan-ipa-dump "bar\[^\\n\]*inline copy in MAIN" "inline" } } -! { dg-final { scan-ipa-dump-times "phi predicate:" 3 "fnsummary" } } +! { dg-final { scan-ipa-dump-times "phi predicate:" 1 "fnsummary" } } ! { dg-final { scan-ipa-dump "IPA hints: loop_iterations" "inline" } }
