Skip to content

Julia 1.9 error: expected Static.StaticInt{1}, got a value of type Static.StaticInt{0} #491

Closed
@droodman

Description

@droodman

I hit an error moving from 1.8.5 to 1.9.0. In the MWE below, I create a 1-vector of vectors. I then run a @turbo loop referring to the first (only) entry in this 1-vector, which I index to using the expression 1+false. It crashes in 1.9.0 but not 1.8.5. Is this a LoopVectorization issue, or is my on-the-fly mixing of integer and Boolean bad enough Julia style that I deserve whatever I get?

There is an easy work-around, which is to wrap the false in Int().

julia> versioninfo()
Julia Version 1.9.0
Commit 8e63055292 (2023-05-07 11:25 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 16 virtual cores
Environment:
  JULIA_IMAGE_THREADS = 1

julia> using LoopVectorization

julia> u = [rand(2)]
1-element Vector{Vector{Float64}}:
 [0.26563842305190977, 0.30181657779394844]

julia> @turbo for r ∈ indices(u[1+false],1)
         u[1][r] = 1
       end
ERROR: TypeError: in typeassert, expected Static.StaticInt{1}, got a value of type Static.StaticInt{0}
Stacktrace:
 [1] convert
   @ .\number.jl:7 [inlined]
 [2] _promote
   @ .\promotion.jl:358 [inlined]
 [3] promote
   @ .\promotion.jl:381 [inlined]
 [4] +(x::Static.StaticInt{1}, y::Bool)
   @ Base .\promotion.jl:410
 [5] top-level scope
   @ .\REPL[10]:1

julia> @turbo for r ∈ indices(u[1+Int(false)],1)
         u[1][r] = 1
       end

julia>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions