if (e->shape == NULL)
e->shape = gfc_copy_shape (op2->shape, op2->corank);
}
- else
+ else if ((op1->ref && !gfc_ref_this_image (op1->ref))
+ || (op2->ref && !gfc_ref_this_image (op2->ref)))
{
gfc_error ("Inconsistent coranks for operator at %L and %L",
&op1->where, &op2->where);
gfc_expression_rank (op2);
return (op1->rank == 0 || op2->rank == 0 || op1->rank == op2->rank)
- && (op1->corank == 0 || op2->corank == 0
- || op1->corank == op2->corank);
+ && (op1->corank == 0 || op2->corank == 0 || op1->corank == op2->corank
+ || (!gfc_is_coindexed (op1) && !gfc_is_coindexed (op2)));
}
/* Resolve a variable expression. */
--- /dev/null
+!{ dg-do compile }
+
+! Check PR120843 is fixed
+
+program p
+ implicit none
+
+ integer, allocatable :: arr(:,:) [:,:]
+ integer :: c[*]
+
+ c = 7
+
+ allocate(arr(4,3)[2,*], source=6)
+
+ if (arr(2,2)* c /= 42) stop 1
+
+end program p