diff options
author | Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> | 2016-07-05 09:33:06 -0600 |
---|---|---|
committer | Alessandro Fanfarillo <afanfa@gcc.gnu.org> | 2016-07-05 09:33:06 -0600 |
commit | 20d0bfcefd6caf09c23113732edd98241a46af56 (patch) | |
tree | ec27aaef1b5d3d90fcdc003d50d5ed2169894af8 /gcc/fortran/trans-intrinsic.c | |
parent | 1174b21b388ba06e8cebfaa2d0a4cc7a026475ad (diff) | |
download | gcc-20d0bfcefd6caf09c23113732edd98241a46af56.zip gcc-20d0bfcefd6caf09c23113732edd98241a46af56.tar.gz gcc-20d0bfcefd6caf09c23113732edd98241a46af56.tar.bz2 |
Second review of STAT= patch + tests
From-SVN: r238007
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 574300e..c655540 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1100,10 +1100,10 @@ static void gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, tree may_require_tmp) { - gfc_expr *array_expr; + gfc_expr *array_expr, *tmp_stat; gfc_se argse; tree caf_decl, token, offset, image_index, tmp; - tree res_var, dst_var, type, kind, vec; + tree res_var, dst_var, type, kind, vec, stat; gcc_assert (flag_coarray == GFC_FCOARRAY_LIB); @@ -1122,6 +1122,19 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, dst_var = lhs; vec = null_pointer_node; + tmp_stat = gfc_find_stat_co(expr); + + if (tmp_stat) + { + gfc_se stat_se; + gfc_init_se(&stat_se, NULL); + gfc_conv_expr_reference (&stat_se, tmp_stat); + stat = stat_se.expr; + gfc_add_block_to_block (&se->pre, &stat_se.pre); + gfc_add_block_to_block (&se->post, &stat_se.post); + } + else + stat = null_pointer_node; gfc_init_se (&argse, NULL); if (array_expr->rank == 0) @@ -1219,9 +1232,9 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, ASM_VOLATILE_P (tmp) = 1; gfc_add_expr_to_block (&se->pre, tmp); - tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_get, 9, + tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_get, 10, token, offset, image_index, argse.expr, vec, - dst_var, kind, lhs_kind, may_require_tmp); + dst_var, kind, lhs_kind, may_require_tmp, stat); gfc_add_expr_to_block (&se->pre, tmp); if (se->ss) @@ -1237,11 +1250,11 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind, static tree conv_caf_send (gfc_code *code) { - gfc_expr *lhs_expr, *rhs_expr; + gfc_expr *lhs_expr, *rhs_expr, *tmp_stat; gfc_se lhs_se, rhs_se; stmtblock_t block; tree caf_decl, token, offset, image_index, tmp, lhs_kind, rhs_kind; - tree may_require_tmp; + tree may_require_tmp, stat; tree lhs_type = NULL_TREE; tree vec = null_pointer_node, rhs_vec = null_pointer_node; @@ -1253,6 +1266,8 @@ conv_caf_send (gfc_code *code) { ? boolean_false_node : boolean_true_node; gfc_init_block (&block); + stat = null_pointer_node; + /* LHS. */ gfc_init_se (&lhs_se, NULL); if (lhs_expr->rank == 0) @@ -1375,10 +1390,25 @@ conv_caf_send (gfc_code *code) { rhs_kind = build_int_cst (integer_type_node, rhs_expr->ts.kind); + tmp_stat = gfc_find_stat_co(lhs_expr); + + if (tmp_stat) + { + gfc_se stat_se; + gfc_init_se (&stat_se, NULL); + gfc_conv_expr_reference (&stat_se, tmp_stat); + stat = stat_se.expr; + gfc_add_block_to_block (&block, &stat_se.pre); + gfc_add_block_to_block (&block, &stat_se.post); + } + else + stat = null_pointer_node; + if (!gfc_is_coindexed (rhs_expr)) - tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_send, 9, token, - offset, image_index, lhs_se.expr, vec, - rhs_se.expr, lhs_kind, rhs_kind, may_require_tmp); + tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_send, 10, token, + offset, image_index, lhs_se.expr, vec, + rhs_se.expr, lhs_kind, rhs_kind, may_require_tmp, + stat); else { tree rhs_token, rhs_offset, rhs_image_index; |