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)
&& 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;