External Issue: 'borrowed' keyword applied to an array crashes the compiler

18717, "twesterhout", "'borrowed' keyword applied to an array crashes the compiler", "2021-11-11T15:24:28Z"

Summary of Problem

Trying to declare a borrowed array causes an internal compiler error.

Steps to Reproduce

Source Code:

record Chunk {
  type eltType;
  var D: domain(1);
  var data: borrowed [D] eltType;

  proc init(type eltType) {
    this.eltType = eltType;
  }

  proc init(array: [?X] ?t) {
    this.eltType = t;
    this.D = X;
    this.data = array;
  }
}

proc main()
{
  var x = new Chunk([1, 2, 3]);
}

Compile command:
chpl -o error error.chpl

Configuration Information

  • Output of chpl --version: 1.25.0
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: unknown
CHPL_LOCALE_MODEL: flat
CHPL_COMM: gasnet *
  CHPL_COMM_SUBSTRATE: smp *
  CHPL_GASNET_SEGMENT: fast
CHPL_TASKS: qthreads
CHPL_LAUNCHER: smp
CHPL_TIMERS: generic
CHPL_UNWIND: system *
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
  CHPL_NETWORK_ATOMICS: none
CHPL_GMP: bundled
CHPL_HWLOC: bundled
CHPL_RE2: bundled
CHPL_LLVM: system *
CHPL_AUX_FILESYS: none
  • Back-end compiler and version, e.g. gcc --version or clang --version: gcc 11.2.0