JuliaDebug / JuliaDebug/Cthulhu.jl
`ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [2]` in `indexed_iterate`
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 709
- Forks
- 46
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 2
Description
julia> using LinearAlgebra, Cthulhu
julia> @descend (A -> ((λ,v) = eigen(A); (λ,v)))(rand(2,2))
(::var"#3#4")(A) @ Main REPL[8]:1
┌ Warning: couldn't retrieve source of (::var"#3#4")(A) @ Main REPL[8]:1
└ @ TypedSyntax ~/.julia/packages/TypedSyntax/AZkb2/src/node.jl:31
Variables
#self#::Core.Const(var"#3#4"())
A::Matrix{Float64}
@_3::Val{:vectors}
v::Union{Matrix{ComplexF64}, Matrix{Float64}}
λ::Union{Vector{ComplexF64}, Vector{Float64}}
∘ ─ %0 = invoke #3(::Matrix{Float64})::Tuple{Union{Vector{ComplexF64}, Vector{Float64}}, Union{Matrix{ComplexF64}, Matrix{Float64}}}
@ REPL[8]:1 within `#3`
1 ─ %1 = Main.eigen(A)::Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{Float64, Float64, Matrix{Float64}, Vector{Float64}}}
│ %2 = Base.indexed_iterate(%1, 1)::Union{Tuple{Vector{ComplexF64}, Val{:vectors}}, Tuple{Vector{Float64}, Val{:vectors}}}
│ (λ = Core.getfield(%2, 1))::Union{Vector{ComplexF64}, Vector{Float64}}
│ (@_3 = Core.getfield(%2, 2))::Core.Const(Val{:vectors}())
│ %5 = Base.indexed_iterate(%1, 2, @_3)::Union{Tuple{Matrix{ComplexF64}, Val{:done}}, Tuple{Matrix{Float64}, Val{:done}}}
│ (v = Core.getfield(%5, 1))::Union{Matrix{ComplexF64}, Matrix{Float64}}
│ %7 = Core.tuple(λ, v)::Tuple{Union{Vector{ComplexF64}, Vector{Float64}}, Union{Matrix{ComplexF64}, Matrix{Float64}}}
└── return %7
Select a call to descend into or ↩ to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
%1 = eigen(::Matrix{Float64})::Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{Float64, Float64, Matrix{Float64}, Vector{Float64}}}
• %2 = call → indexed_iterate(::Union{Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}}, Eigen{Float64, Float64, Matrix{Float64}, Vector{Float64}}},::Int64)::…
%5 = call → indexed_iterate(…,…,…)::Union{Tuple{Matrix{ComplexF64}, Val{:done}}, Tuple{Matrix{Float64}, Val{:done}}}
↩
• %2 = = < semi-concrete eval > indexed_iterate(::Eigen{ComplexF64, ComplexF64, Matrix{ComplexF64}, Vector{ComplexF64}},::Core.Const(1))::…
%2 = = < semi-concrete eval > indexed_iterate(::Eigen{Float64, Float64, Matrix{Float64}, Vector{Float64}},::Core.Const(1))::…
↩
[ Info: tracking Base
ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [2]
Stacktrace:
[1] getindex
@ ./essentials.jl:13 [inlined]
[2] getindex
@ ./compiler/ssair/ir.jl:243 [inlined]
[3] getindex
@ ./compiler/ssair/ir.jl:1059 [inlined]
[4] getindex
@ ./compiler/ssair/ir.jl:1044 [inlined]
[5] abstract_eval_ssavalue
@ ./compiler/optimize.jl:373 [inlined]
[6] argextype(x::Any, src::Core.Compiler.IRCode, sptypes::Vector{Any}, slottypes::Vector{Any})
@ Core.Compiler ./compiler/optimize.jl:358
[7] #15
@ ~/Dropbox/JuliaPackages/Cthulhu.jl/src/reflection.jl:45 [inlined]
[8] map!(f::Cthulhu.var"#15#16"{Core.Compiler.IRCode, Vector{Any}, Vector{Any}}, dest::Vector{Any}, A::Vector{Any})
@ Base ./abstractarray.jl:3254
[9] mapany(f::Function, A::Vector{Any})
@ Base ./abstractarray.jl:3263
[10] find_callsites(interp::Cthulhu.CthulhuInterpreter, CI::Core.Compiler.IRCode, stmt_infos::Vector{Core.Compiler.CallInfo}, mi::Core.MethodInstance, slottypes::Vector{Any}, optimize::Bool, annotate_source::Bool)
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/reflection.jl:44
[11] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Cthulhu.SemiConcreteCallInfo, debuginfo::Cthulhu.DInfo.DebugInfo, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool, annotate_source::Bool)
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:501
[12] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Nothing, debuginfo::Symbol, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool, annotate_source::Bool)
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:634
[13] _descend
@ ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:418 [inlined]
[14] #_descend#107
@ ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:770 [inlined]
[15] _descend
@ ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:770 [inlined]
[16] #_descend#110
@ ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:786 [inlined]
[17] __descend_with_error_handling(args::Any; terminal::Any, kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:244
[18] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:iswarn,), Tuple{Bool}}})
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:233
[19] descend_code_typed(::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:178
[20] descend_code_typed(::Any, ::Any)
@ Cthulhu ~/Dropbox/JuliaPackages/Cthulhu.jl/src/Cthulhu.jl:178
[21] top-level scope
@ REPL[8]:1
This is continuing https://github.com/JuliaDebug/Cthulhu.jl/issues/443 after the fix in https://github.com/JuliaDebug/Cthulhu.jl/pull/444.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the Julia REPL example in the issue, then inspect find_callsites in src/reflection.jl around line 44 and the _descend path in src/Cthulhu.jl. Compare this continuation with issue 443 and pull request 444, and consider the issue resolved when the same descent no longer raises the BoundsError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100