External Issue: Chapel compiler bug when using zippered iteration on unset 'config param my_var:string'

18595, "glitch", "Chapel compiler bug when using zippered iteration on unset 'config param my_var:string'", "2021-10-19T13:44:06Z"

Summary of Problem

Chapel compiler bug when using zippered iteration on unset config param my_var:string.
Very minor, NOT blocking issue. I came across this when I had an unset config param string and so far only using a zippered iteration on the codepoints (doing a non-zip for loop on the codepoints of an unset config param string compiled & ran without issue). Obviously setting the config param during compilation or initializing it with a default value works just fine.

Compiler output

$CHPL_HOME/modules/internal/String.chpl:2326: In method 'numCodepoints':
$CHPL_HOME/modules/internal/String.chpl:2327: internal error: AST-EXP-1147 chpl version 1.25.0

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.

  $CHPL_HOME/modules/internal/String.chpl:2331: called as param ().numCodepoints
  within internal functions (use --print-callstack-on-error to see)
note: generic instantiations are underlined in the above callstack

Steps to Reproduce

Source Code:

/**
 * Example program to illustrate issue with String.codepoints and empty
 * config param.
 * NOTE: Works fine if used in regular for-loop, but the zip version breaks
 */
config param version:string;

for (c, i) in zip(version.codepoints(), 0..<version.size) {
    writeln("codepoint:", c, ", iteration:", i);
}

Compile command:
Breaks: chpl example.chpl
Works: chpl example.chpl -sversion="\"1.2.3\""

Configuration Information

  • Output of chpl --version: chpl version 1.25.0 built with LLVM version 11.0.1