diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-15 14:53:55 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-15 14:53:55 +0000 |
commit | bfc5d51b5a2c80cb142d75dafec7d27a9e7a0f00 (patch) | |
tree | 64b1cf86d7267525f4882d22ee8dde0a6c359b88 /gcc/fortran/trans-intrinsic.c | |
parent | 4fe86c664f4ce5a8dfe6ab4c9845d07302dff7b8 (diff) | |
download | gcc-bfc5d51b5a2c80cb142d75dafec7d27a9e7a0f00.tar.gz |
2011-12-15 Tobias Burnus <burnus@net-b.de>
* primary.c (gfc_match_varspec): Match array spec for
polymorphic coarrays.
(gfc_match_rvalue): If a symbol of unknown flavor has a
codimension, mark it as a variable.
* simplify.c (gfc_simplify_image_index): Directly call
simplify_cobound.
* trans-intrinsic.c (trans_this_image): Fix handling of
corank = 1 arrays.
2011-12-15 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray/poly_run_3.f90: New.
* gfortran.dg/coarray/poly_run_2.f90: Enable comment-out test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182371 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 58112e37ee9..5c964c1229f 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1054,6 +1054,11 @@ trans_this_image (gfc_se * se, gfc_expr *expr) one always has a dim_arg argument. m = this_images() - 1 + if (corank == 1) + { + sub(1) = m + lcobound(corank) + return; + } i = rank min_var = min (rank + corank - 2, rank + dim_arg - 1) for (;;) @@ -1070,15 +1075,29 @@ trans_this_image (gfc_se * se, gfc_expr *expr) : m + lcobound(corank) */ + /* this_image () - 1. */ + tmp = fold_convert (type, gfort_gvar_caf_this_image); + tmp = fold_build2_loc (input_location, MINUS_EXPR, type, tmp, + build_int_cst (type, 1)); + if (corank == 1) + { + /* sub(1) = m + lcobound(corank). */ + lbound = gfc_conv_descriptor_lbound_get (desc, + build_int_cst (TREE_TYPE (gfc_array_index_type), + corank+rank-1)); + lbound = fold_convert (type, lbound); + tmp = fold_build2_loc (input_location, PLUS_EXPR, type, tmp, lbound); + + se->expr = tmp; + return; + } + m = gfc_create_var (type, NULL); ml = gfc_create_var (type, NULL); loop_var = gfc_create_var (integer_type_node, NULL); min_var = gfc_create_var (integer_type_node, NULL); /* m = this_image () - 1. */ - tmp = fold_convert (type, gfort_gvar_caf_this_image); - tmp = fold_build2_loc (input_location, MINUS_EXPR, type, tmp, - build_int_cst (type, 1)); gfc_add_modify (&se->pre, m, tmp); /* min_var = min (rank + corank-2, rank + dim_arg - 1). */ |