Skip to content

reintepret reshape of 0-dimensional array #54623

@FeatherPurple

Description

@FeatherPurple

I installed Julia with the command curl -fsSL https://install.julialang.org | sh. I couldn't find anyone else talking about this specific issue anywhere I looked, but I apologize if I just missed it. There seems to be a problem displaying reinterpreted/reshapeed 0-dimensional arrays. Despite the fact that the elements of this array are Int64s, they are shown as 0-dimensional arrays of Int64s with unrelated contents. The setup is shown below.

julia> versioninfo()
Julia Version 1.10.3
Commit 0b4590a5507 (2024-04-30 10:59 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 10 default, 0 interactive, 5 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_THREADS = 10

julia> r = reinterpret(reshape, Int, fill(1 => 2))
2-element reinterpret(reshape, Int64, ::Array{Pair{Int64, Int64}, 0}) with eltype Int64:
 fill(4538293232)
 fill(4539746992)

julia> r[1], r[2], collect(r)
(1, 2, [1, 2])

julia> typeof(r)
Base.ReinterpretArray{Int64, 1, Pair{Int64, Int64}, Array{Pair{Int64, Int64}, 0}, true}

julia> typeof(fill(4538293232))
Array{Int64, 0}

julia> eltype(r)
Int64

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]bugIndicates an unexpected problem or unintended behaviorcorrectness bug ⚠Bugs that are likely to lead to incorrect results in user code without throwing

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions