20516, "daviditen", "Borrowed classes get immediately freed after the first", "2022-08-25T20:49:43Z"
Summary of Problem
When a borrowed class is created with
var Log: borrowed Logger?;
Log = (new owned DefaultLogger()).borrow();
Log!.Println("I want to print from my DefaultLogger");
It is allocated and lives until the end of the scope. However if you allocate another class in the same way it is immediately free
d and is not usable.
Log = (new owned DefaultLogger2()).borrow();
Log!.Println("I want to print from my DefaultLogger2"); // potential crash here
These tests are hitting this problem, but often run anyway unless using a tool like valgrind:
[Error matching program output for classes/deitz/dispatch/test_dc1]
[Error matching program output for classes/deitz/inherit/test_inherit4b]
[Error matching program output for functions/varargs/varargOverrideGeneric]
Configuration Information
- Output of
chpl --version
:
chpl version 1.28.0 pre-release (c55c625893)
built with LLVM version 13.0.1 - Output of
$CHPL_HOME/util/printchplenv --anonymize
:
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: llvm *
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: bundled *
CHPL_MEM: cstdlib *
CHPL_ATOMICS: cstdlib
CHPL_GMP: bundled *
CHPL_HWLOC: none
CHPL_RE2: none *
CHPL_LLVM: system *
CHPL_AUX_FILESYS: none