# Strange --- seemingly out-of-bounds access --- bug in Julia v1.6

**URL:** <https://discourse.julialang.org/t/strange-seemingly-out-of-bounds-access-bug-in-julia-v1-6/101041>\
**Category:** General Usage\
**Tags:** question, bug, array, linearalgebra, arrays\
**Created:** [July 1, 2023, 4:06am UTC](https://discourse.julialang.org/t/strange-seemingly-out-of-bounds-access-bug-in-julia-v1-6/101041 "2023-07-01T04:06:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jishnub](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jishnub/32/33620_2.png) [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Post date:** [July 1, 2023, 4:06am UTC](https://discourse.julialang.org/t/strange-seemingly-out-of-bounds-access-bug-in-julia-v1-6/101041/1 "2023-07-01T04:06:53Z")

</div>

Using Julia v1.6.7, I obtain

```julia
julia> using LinearAlgebra, FillArrays

julia> for (dv, ev) in ((Fill(2,3), Fill(6,2)), (Zeros(2), Zeros(1)))
                      display(Tridiagonal(ev, dv, ev))
                  end
3×3 Tridiagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}:
 2 6 ⋅
 6 2 6
 ⋅ 6 2
140507853782720×140507853782720 Tridiagonal{Int64, Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}:
 1 22 ⋅ ⋅ ⋅ ⋅ … ⋅ ⋅ ⋅ ⋅
 1 1 22 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ 1 1 22 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ #undef 1 22 ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ #undef 1 22 ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ #undef 1 … ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ #undef ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋮ ⋮ ⋱                          
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ … #undef ⋅ ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1 #undef ⋅ ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ #undef 1 #undef ⋅
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ #undef 1 #undef
 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ #undef 1

```

Where’s that second result coming from? This seems fixed on recent versions of Julia. Both the values and the type are incorrect.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [July 1, 2023, 4:42am UTC](https://discourse.julialang.org/t/strange-seemingly-out-of-bounds-access-bug-in-julia-v1-6/101041/2 "2023-07-01T04:42:37Z")

</div>

Seems like hardware info (included in `versioninfo()` AFAIK) might be interesting.

EDIT: I can reproduce:

```julia-repl
julia> versioninfo()
Julia Version 1.6.7
Commit 3b76b25b64 (2022-07-19 15:11 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: AMD Ryzen 3 5300U with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, znver2)
julia> for (dv, ev) in ((Zeros(2), Zeros(1)),)
         display(size(Tridiagonal(ev, dv, ev)))
       end
(2, 2)

julia> for (dv, ev) in ((Fill(2,3), Fill(6,2)), (Zeros(2), Zeros(1)))
         display(size(Tridiagonal(ev, dv, ev)))
       end
(3, 3)
(140050683035328, 140050683035328)

julia> for (dv, ev) in ((Fill(2,3), Fill(6,2)), (Zeros(2), Zeros(1)))
         display(size(Tridiagonal(ev, dv, ev)))
       end
(3, 3)
(140050683035328, 140050683035328)

```

The numbers change after restarting Julia:

```julia-repl
julia> using LinearAlgebra, FillArrays

julia> for (dv, ev) in ((Fill(2,3), Fill(6,2)), (Zeros(2), Zeros(1)))
         display(size(Tridiagonal(ev, dv, ev)))
       end
(3, 3)
(140677421659760, 140677421659760)

```
