19613, "mstrout", "Compiler bug when fields not all initialized", "2022-04-06T18:08:32Z"
Summary of Problem
It seems like there is a compiler bug if I have a default initial value for one field of a class but not another. But I am not sure. I found a quick workaround, so this is not a stopping issue for me.
Steps to Reproduce
Source Code:
use IO;
config const inputFile = "testin3.txt";
// open a file and create a reader
var f = open(inputFile, iomode.r);
var reader = f.reader();
// A 5-digit binary class
class FiveDigitBinary {
var digit : [1..5] int;
var next : FiveDigitBinary? = nil; // line 31
}
The code modification that did not run into the compiler bug was as follows:
// A num-digit binary class
class BinaryDigits {
var digit : [1..numDigits] int = 0;
var next : owned BinaryDigits? = nil;
}
It also worked before changing the 5
to numDigits
.
Execution command:
$ chpl day3-binary.chpl
day3-binary.chpl:31: internal error: UTI-MIS-0935 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.
Configuration Information
chpl --version
chpl version 1.26.0
built with LLVM version 13.0.1
Copyright 2020-2022 Hewlett Packard Enterprise Development LP
Copyright 2004-2019 Cray Inc.
(See LICENSE file for more details)
$CHPL_HOME/util/printchplenv --anonymize
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none *
CHPL_TASKS: fifo *
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: cstdlib *
CHPL_ATOMICS: cstdlib
CHPL_GMP: none *
CHPL_HWLOC: none
CHPL_RE2: none *
CHPL_LLVM: none *
CHPL_AUX_FILESYS: none
clang --version
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin