-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
The test case from this discourse question leads to a segfault after the local function definitions are changed to either anonymous functions (which I tried locally) or local assignment of different functions (as shown in the third reply).
A later reply identified just changing The @error to error() in the function definition avoids the segfault.else branch doesn't define showcase(), so the later call should result in an UndefVarError being thrown. (The earlier observation that error() works is because that cases the function to throw an actual error and exit the function before the call following the if-else block is called.)
I've tried out Julia v1.5's new julia --bug-report=rr tool — the rr dump was uploaded to https://s3.amazonaws.com/julialang-dumps/reports/2020-08-28T15-12-54-jmert.tar.zst
Julia version:
julia> versioninfo()
Julia Version 1.5.0-beta1.0
Commit 6443f6c95a (2020-05-28 17:42 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
(I had to switch to my Intel laptop since rr doesn't run on Ryzen, and I didn't realize I still had the beta installed on the laptop. I can reproduce with v1.5.1 if need be.)
Test script:
using Printf
function switchcase(i, str)
case = str
if uppercase(case) == "A"
@info "set case A"
showcase = i -> @printf("case A number %i", i)
elseif uppercase(case) == "B"
@info "set case B"
showcase = i -> @printf("case B number %i and some more parameters %i", i, 8)
else
@error("no case $case")
end
showcase(i)
end
switchcase(2, "C")