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 freed 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