aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2014-06-25 22:31:32 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2014-06-25 22:31:32 +0200
commit5c75088c80c2f661d435731dec5c3bc95376b9da (patch)
treeb78359680b9fe9703b183f0741b895d551ea0837 /gcc/fortran/resolve.c
parentaa9ca5ca4f3e9e272a7dcc518d037927b319bb27 (diff)
downloadgcc-5c75088c80c2f661d435731dec5c3bc95376b9da.zip
gcc-5c75088c80c2f661d435731dec5c3bc95376b9da.tar.gz
gcc-5c75088c80c2f661d435731dec5c3bc95376b9da.tar.bz2
resolve.c (resolve_ordinary_assign): Don't invoke caf_send when assigning a coindexed RHS scalar to a noncoindexed...
2014-06-25 Tobias Burnus <burnus@net-b.de> fortran/ * resolve.c (resolve_ordinary_assign): Don't invoke caf_send when assigning a coindexed RHS scalar to a noncoindexed LHS array. * trans-intrinsic.c (conv_caf_send): Do numeric type conversion for a noncoindexed scalar RHS. gcc/testsuite/ * gfortran.dg/coarray/coindexed_1.f90: New. libgfortran/ * caf/single.c (assign_char4_from_char1, * assign_char1_from_char4, convert_type): New static functions. (_gfortran_caf_get, _gfortran_caf_send): Use them. From-SVN: r211993
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 48b3a40..ca20c29 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9300,12 +9300,15 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
/* Insert a GFC_ISYM_CAF_SEND intrinsic, when the LHS is a coindexed variable.
Additionally, insert this code when the RHS is a CAF as we then use the
GFC_ISYM_CAF_SEND intrinsic just to avoid a temporary; but do not do so if
- the LHS is (re)allocatable or has a vector subscript. */
+ the LHS is (re)allocatable or has a vector subscript. If the LHS is a
+ noncoindexed array and the RHS is a coindexed scalar, use the normal code
+ path. */
if (gfc_option.coarray == GFC_FCOARRAY_LIB
&& (lhs_coindexed
|| (code->expr2->expr_type == EXPR_FUNCTION
&& code->expr2->value.function.isym
&& code->expr2->value.function.isym->id == GFC_ISYM_CAF_GET
+ && (code->expr1->rank == 0 || code->expr2->rank != 0)
&& !gfc_expr_attr (rhs).allocatable
&& !gfc_has_vector_subscript (rhs))))
{