New Issue: begin in exported library results in dereference error

16583, “ben-albrecht”, “begin in exported library results in dereference error”, “2020-10-13T21:31:57Z”

Summary of Problem

Calling a begin statement in an exported function results in a dereference nil error.

Steps to Reproduce

Source Code:

// foo.chpl
export proc hello() {
  writeln('hello');
  begin writeln('world');
}

Compile command:

chpl --library-python foo.chpl

Execution command:

# test.py
from foo import foo
foo.chpl_setup()
foo.hello()
> ./test.py
hello
foo.chpl:9: error: attempt to dereference nil

Configuration Information

  • Output of chpl --version: chpl version 1.23.0
  • Output of $CHPL_HOME/util/printchplenv --anonymize:
CHPL_HOST_PLATFORM: darwin
CHPL_HOST_COMPILER: clang
CHPL_HOST_ARCH: x86_64
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: none *
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: gmp
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_LLVM: none
CHPL_AUX_FILESYS: none
CHPL_LIB_PIC: pic *
CHPL_SANITIZE: none
CHPL_SANITIZE_EXE: none