28700, "jabraham17", "[Bug]: Cannot copy map across locales", "2026-04-17T18:49:52Z"
Summary of Problem
Description:
I am trying to create a map on one locale, and then copy it to another. This results in a segfault. My actual app has a map of strings to custom records wrapped in a record (and results in a much harder to track error), but I created a reproducer with simple maps of ints. Sets and lists do not have the same problem
This seems highly related to [Bug]: Iterating over a remote (locally scoped) `map`'s keys() or values() doesn't work · Issue #28266 · chapel-lang/chapel · GitHub
Is this issue currently blocking your progress?
yes. I have no workaround
Steps to Reproduce
Source Code:
use Map;
proc get(loc) {
var m: map(int, int);
on loc {
var m1 = new map(int, int);
m1.add(1, 10);
m1.add(2, 20);
writeln("map has been created on locale ", here.id, ": ", m1);
m = m1; // causes segfault
}
writeln("map has been returned to locale ", here.id, ": ", m);
return m;
}
proc main() {
var m = get(Locales.last);
writeln(m);
}
Copying m1 to m causes a segfault. The following pattern is also broken
var m: ...
on loc {
m.add(1, 10); // segfaults
}
chpl bug.chpl
./bug -nl 2
Configuration Information
CHPL_HOME: /opt/homebrew/Cellar/chapel2.9.0/2.9.0/libexec *
script location: /opt/homebrew/Cellar/chapel2.9.0/2.9.0/libexec/util/chplenv
CHPL_HOST_PLATFORM: darwin
CHPL_HOST_COMPILER: clang
CHPL_HOST_CC: clang
CHPL_HOST_CXX: clang++
CHPL_HOST_ARCH: arm64
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: llvm
CHPL_TARGET_CC: /opt/homebrew/Cellar/llvm@21/21.1.8/bin/clang-21
CHPL_TARGET_CXX: /opt/homebrew/Cellar/llvm@21/21.1.8/bin/clang++
CHPL_TARGET_LD: /opt/homebrew/Cellar/llvm@21/21.1.8/bin/clang++
CHPL_TARGET_ARCH: arm64
CHPL_TARGET_CPU: native +
CHPL_LOCALE_MODEL: flat
CHPL_COMM: gasnet *
CHPL_COMM_SUBSTRATE: udp
CHPL_GASNET_SEGMENT: everything
CHPL_TASKS: qthreads
CHPL_LAUNCHER: amudprun
CHPL_TIMERS: generic
CHPL_UNWIND: system
CHPL_HOST_MEM: cstdlib
CHPL_TARGET_MEM: jemalloc +
CHPL_TARGET_JEMALLOC: system +
CHPL_ATOMICS: cstdlib
CHPL_NETWORK_ATOMICS: none
CHPL_GMP: system +
CHPL_HWLOC: system +
CHPL_RE2: bundled +
CHPL_LLVM: system +
CHPL_LLVM_SUPPORT: system
CHPL_LLVM_CONFIG: /opt/homebrew/opt/llvm@21/bin/llvm-config +
CHPL_LLVM_VERSION: 21
CHPL_AUX_FILESYS: none
CHPL_LIB_PIC: none
CHPL_SANITIZE: none
CHPL_SANITIZE_EXE: none