Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Error: BoundsError #30093

Closed
turtleslow opened this issue Nov 20, 2018 · 9 comments · Fixed by #33566
Closed

Internal Error: BoundsError #30093

turtleslow opened this issue Nov 20, 2018 · 9 comments · Fixed by #33566

Comments

@turtleslow
Copy link

turtleslow commented Nov 20, 2018

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))
@goretkin
Copy link
Contributor

Does this happen on the v1.0.3 release candidate?

@KristofferC
Copy link
Sponsor Member

Yes, but not on master.

@goretkin
Copy link
Contributor

Thanks for the reply. I added a dummy counter to a while loop and it "fixed" this for me. Any idea what's going on?

@KristofferC
Copy link
Sponsor Member

Some bug in the optimizer probably.

@StefanKarpinski
Copy link
Sponsor Member

@Keno, @JeffBezanson—do either of you remember fixing this?

@vtjnash
Copy link
Sponsor Member

vtjnash commented Feb 13, 2019

@Keno has this been fixed?

@Keno
Copy link
Member

Keno commented Feb 13, 2019

I don't remember looking at this specifically, but there were a few other bugs involving try/catch that did get fixed.

@s2maki
Copy link
Contributor

s2maki commented Apr 22, 2019

For the record, this does definitely still occur in 1.0.3, but appears to be fixed in 1.1.0.

Does the "LTR" in 1.0.3 mean that the fix should be backported to 1.0 to create a 1.0.4? Or should this issue be closed?

@maleadt
Copy link
Member

maleadt commented Sep 18, 2019

Bisected the fix to #28878, which isn't very useful...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants