External Issue: Another internal compiler error with lambdas

18636, "twesterhout", "Another internal compiler error with lambdas", "2021-10-27T21:02:55Z"

Summary of Problem

Compilation fails with an internal compiler error.

Steps to Reproduce

Source Code:

proc merge(xs: [?Dom] ?eltType, ys: []) {
  const count = xs.size + ys.size;
  var dst: [0..#count] eltType;
  if (xs.size == 0) { dst = ys; return dst; }
  if (ys.size == 0) { dst = xs; return dst; }

  var i_xs = 0;
  var i_ys = 0;
  var i = 0;
  var writeFromFirst = lambda() {
    dst[i] = xs[i_xs];
    i_xs += 1;
    i += 1;
  };
  var writeFromSecond = lambda() {
    dst[i] = ys[i_ys];
    i_ys += 1;
    i += 1;
  };
  while (i < count) {
    if (xs[i_xs] <= ys[i_ys]) { writeFromFirst(); }
    else { writeFromSecond(); }
  }
  return dst;
}

proc main()
{
  var x = merge([1, 7, 8], [5, 11]);
}

p.s. don't mind the code itself, it's incorrect. This shouldn't cause the compiler to crash though.

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