chapel
chapel copied to clipboard
Implement/improve error messages for misuse of `localAccess`
var Arr = [1,2,3];
on Locales[1] {
writeln(Arr.localAccess[0]);
}
does not produce any error message with checks enabled, but it should.
Whereas
use BlockDist;
var Arr = blockDist.createArray(1..10, int);
on Locales[1] {
writeln(Arr.localAccess[1]);
}
produces
$CHPL_HOME/drlocaltest.chpl:14: error: halt reached - array index out of bounds
note: index was 1 but array bounds are 6..10
which is better than no error message. However, ideally, we should not be reporting this as OOB.
The localSubdomain query works correctly for remote, local arrays:
var A: [1..10] real;
on Locales[1] {
writeln(A.localSubdomain()); // prints {1..0}, a degenerate/empty domain
}
So that might suggest a straightforward path for implementing this check.
I needed a simple coding task to break up the tedium of catching up on backlog, so have a fix for the DR case that seems to be working.
And now I've extended it to distributed arrays as well: https://github.com/chapel-lang/chapel/pull/25754
#25754 is now up for review and should resolve this issue.
Re-opening this since I ended up backing out #25754 for the 2.2 release.