New Issue: Nil dereference for maps of domains

20167, "ronawho", "Nil dereference for maps of domains", "2022-07-06T20:23:55Z"

Related to How to efficiently store distributed arrays in classes? · Issue #20164 · chapel-lang/chapel · GitHub, I'm trying to cache distributed domains in Arkouda. However, I'm seeing issues when storing domains in a map. Here's a simplified reproducer using local domains.

use Map;

type domType = {0..0}.type;
var tab: map(int, domType);

proc cachedDom(size: int) const ref {
  if !tab.contains(size) {
    tab.add(size, {0..<size});
  return tab.getReference(size);

proc main() {
  var d = cachedDom(10);
chpl cache-dom.chpl
cache-dom.chpl:8: error: attempt to dereference nil # tab.add(size, {0..<size});

CHPL_UNWIND=system chpl cache-dom.chpl --devel

$CHPL_HOME/modules/internal/ChapelArray.chpl:760: error: attempt to dereference nil

newRectangularDom() at $CHPL_HOME/modules/internal/ChapelArray.chpl:757
newRectangularDom() at $CHPL_HOME/modules/internal/ChapelArray.chpl:770
init() at $CHPL_HOME/modules/internal/ChapelDomain.chpl:959
cachedDom() at cache-dom.chpl:6
main() at cache-dom.chpl:13

Where the nil seems to be at at chapel/ChapelArray.chpl at 3ffc1fff4a2329753f5addb752beb85c1d5416c7 · chapel-lang/chapel · GitHub

Note that in my real use case the domain type is either default rectangular or block depending on CHPL_COMM