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

Julia 1.8 crashes with @time macro #46483

Closed
RJDennis opened this issue Aug 25, 2022 · 4 comments · Fixed by #46388
Closed

Julia 1.8 crashes with @time macro #46483

RJDennis opened this issue Aug 25, 2022 · 4 comments · Fixed by #46388
Labels
regression Regression in behavior compared to a previous version

Comments

@RJDennis
Copy link

The following MWE causes Julia to crash:

len = 1e16
while len > 1e-8
    a = 0
    @time for i = 1:10_000
        a += 1
    end
    len /= 2
 end

Removing the @time works okay.

versioninfo()
Julia Version 1.8.0
Commit 5544a0f (2022-08-17 13:38 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 24 × AMD Ryzen 9 3900X 12-Core Processor
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, znver2)
Threads: 1 on 24 virtual cores

@giordano
Copy link
Contributor

giordano commented Aug 25, 2022

Actually showing the output, for reference:

julia> len = 1e16
1.0e16

julia> while len > 1e-8
           a = 0
           @time for i = 1:10_000
               a += 1
           end
           len /= 2
        end
Internal error: encountered unexpected error in runtime:
BoundsError(a=Array{Core.Compiler.BasicBlock, (26,)}[Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=1, stop=5), preds=Array{Int64, (1,)}[25], succs=Array{Int64, (2,)}[26, 2]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=6, stop=9), preds=Array{Int64, (1,)}[1], succs=Array{Int64, (2,)}[4, 3]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=10, stop=11), preds=Array{Int64, (1,)}[2], succs=Array{Int64, (1,)}[5]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=12, stop=12), preds=Array{Int64, (1,)}[2], succs=Array{Int64, (1,)}[5]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=13, stop=13), preds=Array{Int64, (2,)}[3, 4], succs=Array{Int64, (1,)}[6]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=14, stop=16), preds=Array{Int64, (1,)}[5], succs=Array{Int64, (1,)}[7]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=17, stop=22), preds=Array{Int64, (1,)}[6], succs=Array{Int64, (2,)}[16, 8]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=23, stop=23), preds=Array{Int64, (1,)}[7], succs=Array{Int64, (2,)}[14, 9]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=24, stop=29), preds=Array{Int64, (2,)}[8, 13], succs=Array{Int64, (2,)}[11, 10]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=30, stop=31), preds=Array{Int64, (1,)}[9], succs=Array{Int64, (1,)}[12]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=32, stop=34), preds=Array{Int64, (1,)}[9], succs=Array{Int64, (1,)}[12]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=35, stop=38), preds=Array{Int64, (2,)}[10, 11], succs=Array{Int64, (2,)}[14, 13]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=39, stop=39), preds=Array{Int64, (1,)}[12], succs=Array{Int64, (1,)}[9]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=40, stop=42), preds=Array{Int64, (2,)}[8, 12], succs=Array{Int64, (1,)}[15]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=43, stop=43), preds=Array{Int64, (1,)}[14], succs=Array{Int64, (1,)}[18]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=44, stop=49), preds=Array{Int64, (1,)}[7], succs=Array{Int64, (1,)}[17]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=50, stop=50), preds=Array{Int64, (1,)}[16], succs=Array{Int64, (1,)}[18]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=51, stop=59), preds=Array{Int64, (2,)}[15, 17], succs=Array{Int64, (2,)}[20, 19]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=60, stop=61), preds=Array{Int64, (1,)}[18], succs=Array{Int64, (1,)}[21]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=62, stop=62), preds=Array{Int64, (1,)}[18], succs=Array{Int64, (1,)}[21]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=63, stop=63), preds=Array{Int64, (2,)}[19, 20], succs=Array{Int64, (1,)}[22]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=64, stop=71), preds=Array{Int64, (1,)}[21], succs=Array{Int64, (2,)}[24, 23]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=72, stop=73), preds=Array{Int64, (1,)}[22], succs=Array{Int64, (0,)}[]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=74, stop=101), preds=Array{Int64, (1,)}[22], succs=Array{Int64, (1,)}[25]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=102, stop=109), preds=Array{Int64, (1,)}[24], succs=Array{Int64, (1,)}[1]), Core.Compiler.BasicBlock(stmts=Core.Compiler.StmtRange(start=110, stop=110), preds=Array{Int64, (1,)}[1], succs=Array{Int64, (0,)}[])], i=(0,))
ijl_bounds_error_ints at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/rtutils.c:194
getindex at ./array.jl:924 [inlined]
getindex at ./abstractarray.jl:1244 [inlined]
replace_code_newstyle! at ./compiler/ssair/legacy.jl:61
ir_to_codeinf! at ./compiler/optimize.jl:145 [inlined]
transform_result_for_cache at ./compiler/typeinfer.jl:364 [inlined]
cache_result! at ./compiler/typeinfer.jl:395
_typeinf at ./compiler/typeinfer.jl:277
typeinf at ./compiler/typeinfer.jl:213
typeinf_ext_toplevel at ./compiler/typeinfer.jl:1009
typeinf_ext_toplevel at ./compiler/typeinfer.jl:996
jfptr_typeinf_ext_toplevel_12553.clone_1 at /usr/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/julia.h:1838 [inlined]
jl_type_infer at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:319
jl_toplevel_eval_flex at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:895
jl_toplevel_eval_flex at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:850
jl_toplevel_eval_flex at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:850
ijl_toplevel_eval_in at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/toplevel.c:965
eval at ./boot.jl:368 [inlined]
eval_user_input at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:151
repl_backend_loop at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:247
start_repl_backend at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:232
#run_repl#47 at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:369
run_repl at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/usr/share/julia/stdlib/v1.8/REPL/src/REPL.jl:355
jfptr_run_repl_67214.clone_1 at /usr/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2549
#966 at ./client.jl:419
jfptr_YY.966_46273.clone_1 at /usr/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/julia.h:1838 [inlined]
jl_f__call_latest at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/builtins.c:774
#invokelatest#2 at ./essentials.jl:729 [inlined]
invokelatest at ./essentials.jl:726 [inlined]
run_main_repl at ./client.jl:404
exec_options at ./client.jl:318
_start at ./client.jl:522
jfptr__start_30463.clone_1 at /usr/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2367 [inlined]
ijl_apply_generic at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/gf.c:2549
jl_apply at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/julia.h:1838 [inlined]
true_main at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/jlapi.c:575
jl_repl_entrypoint at /cache/build/default-amdci4-3/julialang/julia-release-1-dot-8/src/jlapi.c:719
main at julia (unknown line)
unknown function (ip: 0x7fbaa1a172cf)
__libc_start_main at /usr/bin/../lib/libc.so.6 (unknown line)
unknown function (ip: 0x401098)

@giordano giordano added the regression Regression in behavior compared to a previous version label Aug 25, 2022
@gbaraldi
Copy link
Member

Looks like a dupe of #45600 which is apparently fixed

@ianatol
Copy link
Member

ianatol commented Aug 26, 2022

I think #46388 just needs to be backported. On master this does not crash

@giordano
Copy link
Contributor

I can confirm this is fixed in master. #46388 is already in the backport PR #46376, so this issue can be closed now.

@giordano giordano closed this as not planned Won't fix, can't repro, duplicate, stale Aug 26, 2022
@giordano giordano linked a pull request Aug 26, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants