chapel icon indicating copy to clipboard operation
chapel copied to clipboard

Implement/improve error messages for misuse of `localAccess`

Open e-kayrakli opened this issue 1 year ago • 5 comments

  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.

e-kayrakli avatar Aug 13 '24 17:08 e-kayrakli

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.

bradcray avatar Aug 13 '24 18:08 bradcray

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.

bradcray avatar Aug 14 '24 00:08 bradcray

And now I've extended it to distributed arrays as well: https://github.com/chapel-lang/chapel/pull/25754

bradcray avatar Aug 14 '24 02:08 bradcray

#25754 is now up for review and should resolve this issue.

bradcray avatar Sep 10 '24 00:09 bradcray

Re-opening this since I ended up backing out #25754 for the 2.2 release.

bradcray avatar Sep 16 '24 16:09 bradcray