External Issue: internal compiler error, maybe related to lambda functions?

20046, "lucaferranti", "internal compiler error, maybe related to lambda functions?", "2022-06-19T13:28:12Z"

Summary of Problem

While playing with ForwardModeAD, a package I'm writing, I hit the following internal compiler error

Skipping registry update since no dependency found in manifest file.
/home/lferrant/ForwardModeAD/example/example1d.chpl:12: internal error: RES-PRE-OLD-2900 chpl version 1.26.0
Note: This source location is a guess.

Internal errors indicate a bug in the Chapel compiler ("It's us, not you"),
and we're sorry for the hassle.  We would appreciate your reporting this bug --
please see https://chapel-lang.org/bugs.html for instructions.  In the meantime,
the filename + line number above may be useful in working around the issue.

compilation failed for example1d.chpl

My lucky guess would be that it has to do with lambda functions, but I'm not sure. Please feel free to change this issue name to be more informative/accurate.

Steps to Reproduce

Source Code:

The code is also available in the example folder of the package here

use ForwardModeAD;

proc f(x) {
    return x ** 2 + 2 * x + 1;
}


var y = derivative(lambda(x : DualNumber) {return f(x);}, 1.0);
writeln(y);

proc df(x) {
    return derivative(lambda(t : DualNumber) {return f(t);}, x); // this is line 12
}

var z = df(1.0);

Compile command:

mason build --example (also chpl example/example1d.chpl -M src/ gives the same outcome)

Execution command:

N/A

Associated Future Test(s):

Configuration Information

  • Output of chpl --version:
chpl version 1.26.0
  built with LLVM version 12.0.0
Copyright 2020-2022 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
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 (Ubuntu 10.3.0-1ubuntu1) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • (For Cray systems only) Output of module list: