Closed
Description
In Julia 1.0.2 this code:
function f1(r)
while r[]>0
try
finally
end
end
end
f1(Ref(0))
produces this error:
Internal error: encountered unexpected error in runtime:
BoundsError(a=Array{Core.Compiler.BasicBlock, (10,)}[
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=1, last=5), preds=Array{Int64, (1,)}[9], succs=Array{Int64, (2,)}[10, 2]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=6, last=6), preds=Array{Int64, (1,)}[1], succs=Array{Int64, (2,)}[5, 3]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=7, last=7), preds=Array{Int64, (1,)}[2], succs=Array{Int64, (1,)}[4]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=8, last=8), preds=Array{Int64, (1,)}[3], succs=Array{Int64, (1,)}[7]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=9, last=9), preds=Array{Int64, (1,)}[2], succs=Array{Int64, (1,)}[6]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=10, last=10), preds=Array{Int64, (1,)}[5], succs=Array{Int64, (1,)}[7]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=11, last=14), preds=Array{Int64, (2,)}[4, 6], succs=Array{Int64, (2,)}[9, 8]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=15, last=17), preds=Array{Int64, (1,)}[7], succs=Array{Int64, (0,)}[]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=18, last=18), preds=Array{Int64, (1,)}[7], succs=Array{Int64, (1,)}[1]),
Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(first=19, last=19), preds=Array{Int64, (1,)}[1], succs=Array{Int64, (0,)}[])], i=(0,))
rec_backtrace at /buildworker/worker/package_linux64/build/src/stackwalk.c:94
record_backtrace at /buildworker/worker/package_linux64/build/src/task.c:246
jl_throw at /buildworker/worker/package_linux64/build/src/task.c:577
jl_bounds_error_ints at /buildworker/worker/package_linux64/build/src/rtutils.c:187
getindex at ./array.jl:731
jfptr_getindex_1592.clone_1 at ./julia/julia-1.0.2/lib/julia/sys.so (unknown line)
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
replace_code_newstyle! at ./compiler/ssair/legacy.jl:80
optimize at ./compiler/optimize.jl:212
typeinf at ./compiler/typeinfer.jl:35
typeinf_ext at ./compiler/typeinfer.jl:567
typeinf_ext at ./compiler/typeinfer.jl:604
jfptr_typeinf_ext_1.clone_1 at ./julia/julia-1.0.2/lib/julia/sys.so (unknown line)
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1537 [inlined]
jl_apply_with_saved_exception_state at /buildworker/worker/package_linux64/build/src/rtutils.c:257
jl_type_infer at /buildworker/worker/package_linux64/build/src/gf.c:275
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:1786 [inlined]
jl_fptr_trampoline at /buildworker/worker/package_linux64/build/src/gf.c:1830
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:324
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:430
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:363 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:682
jl_interpret_toplevel_thunk_callback at /buildworker/worker/package_linux64/build/src/interpreter.c:806
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f579351878f)
unknown function (ip: (nil))
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:815
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:805
jl_parse_eval_all at /buildworker/worker/package_linux64/build/src/ast.c:838
jl_load at /buildworker/worker/package_linux64/build/src/toplevel.c:839
include at ./boot.jl:317 [inlined]
include_relative at ./loading.jl:1044
include at ./sysimg.jl:29
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
exec_options at ./client.jl:231
_start at ./client.jl:425
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2184
jl_apply at /buildworker/worker/package_linux64/build/ui/../src/julia.h:1537 [inlined]
true_main at /buildworker/worker/package_linux64/build/ui/repl.c:112
main at /buildworker/worker/package_linux64/build/ui/repl.c:233
__libc_start_main at /lib64/libc.so.6 (unknown line)
_start at ./julia (unknown line)
Minor modifications allow the function to work without error, e.g.:
function f2(r)
while r[]>0
try
catch
end
end
end
f2(Ref(0))
function f3(r)
while r[]>0
try
finally
end
break
end
end
f3(Ref(0))
function f4(r)
r
while r[]>0
try
finally
end
end
end
f4(Ref(0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels