aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2021-02-19 18:07:26 +0100
committerTobias Burnus <tobias@codesourcery.com>2021-02-19 18:07:26 +0100
commitf86e187e12db14ad1cced26b9f8aafb06498e208 (patch)
tree2a9a86175927a7508acd3617bbcf50c6e1fa0a73 /gcc/fortran
parent72d91d6cd41f2987339a98c2c64f70b3850f4e0b (diff)
downloadgcc-f86e187e12db14ad1cced26b9f8aafb06498e208.zip
gcc-f86e187e12db14ad1cced26b9f8aafb06498e208.tar.gz
gcc-f86e187e12db14ad1cced26b9f8aafb06498e208.tar.bz2
Fortran: Fix coarray handling for gfc_dep_resolver [PR99010]
Check failed if identical = false was requested or for -fcoarray=single if an array ref was for a coindexed scalar. gcc/fortran/ChangeLog: PR fortran/99010 * dependency.c (gfc_dep_resolver): Fix coarray handling. gcc/testsuite/ChangeLog: PR fortran/99010 * gfortran.dg/coarray/array_temporary-1.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/dependency.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c
index 5de3b2c..e1336e1 100644
--- a/gcc/fortran/dependency.c
+++ b/gcc/fortran/dependency.c
@@ -2145,9 +2145,9 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
case REF_ARRAY:
/* Coarrays: If there is a coindex, either the image differs and there
is no overlap or the image is the same - then the normal analysis
- applies. Hence, return early only if 'identical' is required and
- either ref is coindexed and more than one image can exist. */
- if (identical && flag_coarray != GFC_FCOARRAY_SINGLE
+ applies. Hence, return early if either ref is coindexed and more
+ than one image can exist. */
+ if (flag_coarray != GFC_FCOARRAY_SINGLE
&& ((lref->u.ar.codimen
&& lref->u.ar.dimen_type[lref->u.ar.dimen]
!= DIMEN_THIS_IMAGE)
@@ -2155,6 +2155,14 @@ gfc_dep_resolver (gfc_ref *lref, gfc_ref *rref, gfc_reverse *reverse,
&& lref->u.ar.dimen_type[lref->u.ar.dimen]
!= DIMEN_THIS_IMAGE)))
return 1;
+ if (lref->u.ar.dimen == 0 || rref->u.ar.dimen == 0)
+ {
+ /* Coindexed scalar coarray with GFC_FCOARRAY_SINGLE. */
+ if (lref->u.ar.dimen || rref->u.ar.dimen)
+ return 1; /* Just to be sure. */
+ fin_dep = GFC_DEP_EQUAL;
+ break;
+ }
if (ref_same_as_full_array (lref, rref))
return identical;