First we summarize rules for distributed array element references given
in section 2.4.
If is a distributed array, then in the element reference

the expression may an integer expression (allowed only if the corresponding dimension of has the sequential attribute), or a bound location. If it is an integer, it must lie in the interval . If it is a location, it must be an element of the range

The rules on subscripts given in the previous paragraph go a long way towards ensuring a crucial requirement of HPJava, namely that a process may only access locally held array elements. Unfortunately there are still odd cases--typically involving array sections--where those rules are insufficient. Consider this pathological example

Procs2 p = new Procs2(P, P) ; on(p) { Range x = new BlockRange(N, p.dim(0)) ; Range y = new BlockRange(N, p.dim(1)) ; float [[,]] a = new float [[x, y]] ; float [[]] b = a [[0, :]] ; at(i = x [N - 1]) overall(j = y for :) b [j] = j` ; // error! }The subscripts on the element reference

This kind of error can be excluded by the following rule.
Suppose the distribution group of is , and the list of subscripts
in the element reference

includes locations {

p / i / j / ...(If the array has a replicated distribution this group may contain several processes; otherwise it contains a single process.) The general rule about accessing array elements can be stated formally as follows

An array element can only be accessed if the active process group is contained in the home group of the element.Informally this simply says that any process involved (active) at the point the array element is accessed must hold a copy of the array element.

The error above is now exposed, because the home group of `b [j]`
is `p / x [0] / j`. This does not contain the active process group
inside the overall construct, which is `p / x [N - 1] / j`.
This kind of error can be trapped by runtime checks in the generated
code. Very often this kind of check can be lifted out of innermost
overall loops, leading to minimal overhead. In the current example a
check that `p / x [0]` contains the active process group, placed
immediately before entering the overall construct, would suffice.