External Issue: internal compiler error when trying to construct a domain as param in the record

20047, "lucaferranti", "internal compiler error when trying to construct a domain as param in the record", "2022-06-20T16:04:02Z"

Summary of Problem

Disclaimer: I strongly suspect that more than a compiler error, the issue is me approaching the problem with the wrong mental model and hence trying some nonsense. That being said, the error message asked me to open an issue, so here I am.

Source Code:

record MultidualNumber {
    param D : domain;
    var prim : real;
    var dual : [D] real;

    proc init(p : real, d : [?D] real) {
        this.D = D;
        this.prim = p;
        this.dual = d;
    }
}

var a = new MultidualNumber(1.0, [1.0, 2.0, 3.0]);
writeln(a);

this leads to the error

$CHPL_HOME/modules/internal/ChapelDomain.chpl:2488: internal error: RES-WRA-ERS-2171 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.

The issue is probably with param domain because e.g. the following

param D : domain = {1..2};

leads to the more instructive error message

error: 'D' is not of a supported param type

Again, I take the blame for doing something very wrong here. A multidual number is basically a number + an array and I was trying to parametrize the record by the array length. I came across this compiler error while experimenting different approaches.

Compile command:

chpl sandbox.chpl

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: