New Issue: Split initialization across cobegins

19617, "stonea", "Split initialization across cobegins", "2022-04-08T01:06:50Z"

Summary of Problem

Many programs start by setting up some data-structure that require some preprocessing before moving on to some later step that makes use of them. Depending on the specifics it may be advantageous to try and use task parallelism like the following:

const a,b;
cobegin {
  a = initializeA();
  b = initializeB();
}

Unfortunately split initialization doesn't seem to work across cobegin statements. Compiling this will result in an error like:

cannot assign to const variable

If I modify the example so that a and b are vars rather than consts I get an even more confusing error:

internal error: Unhandled type in blankIntentForType() [passes/resolveIntents.cpp:168]

Steps to Reproduce

Source Code:

var a,b;
proc foo() { return 42; }
cobegin {
  a = foo();
  b = foo();
}

Compile command:
chpl foo.chpl

Associated Future Test(s):

(to be created)

Configuration Information

$ chpl --version
chpl version 1.27.0 pre-release (a4373b47a9)
  built with LLVM version 11.1.0
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: 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

$ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin