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

Incorrect argument types displayed for inlined method in stacktrace #52709

Closed
jishnub opened this issue Jan 3, 2024 · 1 comment
Closed

Incorrect argument types displayed for inlined method in stacktrace #52709

jishnub opened this issue Jan 3, 2024 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior error messages Better, more actionable error messages

Comments

@jishnub
Copy link
Contributor

jishnub commented Jan 3, 2024

julia> using ToeplitzMatrices, LinearAlgebra

julia> H = Hankel(1:5)
3×3 Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}:
 1  2  3
 2  3  4
 3  4  5

julia> triu(H)
ERROR: CanonicalIndexError: setindex! not defined for Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}
Stacktrace:
 [1] error_if_canonical_setindex(::IndexCartesian, ::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}, ::Int64, ::Int64)
   @ Base ./abstractarray.jl:1403
 [2] setindex!
   @ ./abstractarray.jl:1392 [inlined]
 [3] triu!(M::Matrix{Float64}, k::Int64)
   @ LinearAlgebra ~/packages/julias/julia-1.10/share/julia/stdlib/v1.10/LinearAlgebra/src/dense.jl:139 [inlined]
 [4] triu!
   @ ~/packages/julias/julia-1.10/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:435 [inlined]
 [5] triu(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})
   @ LinearAlgebra ~/packages/julias/julia-1.10/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:341
 [6] top-level scope
   @ REPL[3]:1

Here, the line [3] is wrong, as the method that is called is triu!(::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}, k::Int) and not triu!(::Matrix{Float64}, k::Int). Note that line [1] contains Hankel again instead of Matrix, which shouldn't be the case if there are no Hankel arguments to triu!.

Cthulhu reports the correct types:

julia> @descend triu(H)
[ Info: tracking LinearAlgebra
triu(M::AbstractMatrix) @ LinearAlgebra ~/packages/julias/julia-1.10/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:341
341 triu(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}::AbstractMatrix)::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}} = triu!(copy(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})
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, [j]ump to source always.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
   copy(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})
 • triu!(copy(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})
   
triu!(M::AbstractMatrix) @ LinearAlgebra ~/packages/julias/julia-1.10/share/julia/stdlib/v1.10/LinearAlgebra/src/generic.jl:435
435 triu!(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}::AbstractMatrix)::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}} = triu!(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}},0)
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, [j]ump to source always.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
 • triu!(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}},0)
   
triu!(M::AbstractMatrix, k::Integer) @ LinearAlgebra ~/packages/julias/julia-1.10/share/julia/stdlib/v1.10/LinearAlgebra/src/dense.jl:134
134 function triu!(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}::AbstractMatrix, k::Int64::Integer)::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}
135     require_one_based_indexing(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})
136     m::Int64, n::Int64 = size(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})::Tuple{Int64, Int64}::Int64
137     for j::Int64 in (1:min(n::Int64, (m::Int64 + k::Int64)::Int64)::Int64)::Int64::Union{Nothing, Tuple{Int64, Int64}}
138         for i in (max(1,( (j::Int64 - k::Int64)::Int64 + 1)::Int64)::Int64:m::Int64)::UnitRange{Int64}::Union{Nothing, Tuple{Int64, Int64}}
139             M[i,j] = zero(M[i,j])::Int64
140         end
141     end
142     M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}}
143 end
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, [j]ump to source always.
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 = require_one_based_indexing(::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})::Any
   size(M)
   size(M)
   size(M::Hankel{Int64, UnitRange{Int64}, Tuple{Int64, Int64}})
    m::Int64 + k::Int64
   min(n::Int64, (m::Int64 + k::Int64)::Int64)
    1:min(n, m + k)
    j::Int64 in (1:min(n::Int64, (m::Int64 + k::Int64)::Int64)::Int64)::Int64
    j::Int64 - k::Int64
v   (j::Int64 - k::Int64)::Int64 + 1

This is on

julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
  Threads: 1 on 8 virtual cores
Environment:
  LD_LIBRARY_PATH = :/usr/lib/x86_64-linux-gnu/gtk-3.0/modules
  JULIA_EDITOR = subl

The issue is also present on v"1.11.0-DEV.1182". This is using v0.8.2 of ToeplitzMatrices.

@jishnub jishnub added error messages Better, more actionable error messages bug Indicates an unexpected problem or unintended behavior labels Jan 3, 2024
@BioTurboNick
Copy link
Contributor

BioTurboNick commented Jan 5, 2024

So this is all caused by code I wrote that was there to lookup inlined method signatures, but the main piece of that was removed because it had detrimental effects, and the fallbacks seem to be more trouble than they're worth. I'll make a PR to drop it altogether until it can be revisited.

aviatesk pushed a commit that referenced this issue Jan 14, 2024
The fallback code that was written for #41099 is causing unintended
issues with some inlined stack frames (one previous #51405, new #52709),
since the main piece, linetable storage and lookup, was removed in
#50546. Probably better to strip it all back to how it was previously,
until it can all be revisited more fully.

Should be backported to 1.10.
aviatesk pushed a commit that referenced this issue Jan 14, 2024
The fallback code that was written for #41099 is causing unintended
issues with some inlined stack frames (one previous #51405, new #52709),
since the main piece, linetable storage and lookup, was removed in
#50546. Probably better to strip it all back to how it was previously,
until it can all be revisited more fully.

Should be backported to 1.10.
Drvi pushed a commit to RelationalAI/julia that referenced this issue Jun 7, 2024
The fallback code that was written for JuliaLang#41099 is causing unintended
issues with some inlined stack frames (one previous JuliaLang#51405, new JuliaLang#52709),
since the main piece, linetable storage and lookup, was removed in
JuliaLang#50546. Probably better to strip it all back to how it was previously,
until it can all be revisited more fully.

Should be backported to 1.10.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior error messages Better, more actionable error messages
Projects
None yet
Development

No branches or pull requests

3 participants