I see truncated backtraces when inducing BoundsErrors, but the extent of 
the truncation seems to vary depending on the array dimensionality and it 
seems like block depth?

I'm running on Version 0.3.0-prerelease+1564 Commit 7ddb311 on Mavericks. 
Is the following the expected behavior?
Out-of-bounds index into a 3-d array:

array_3d = zeros(Int32, (2, 2, 2))
function inner()
    array_3d[3, 3, 3]
end
function outer()
    inner()
end
outer()

produces:

ERROR: BoundsError()
 in getindex at array.jl:279
while loading /home/alex/test.jl, in expression starting on line 13

Here I lose both inner() and outer() in the backtrace.
If I do this instead with a 1-d array:

array_1d = [1,2]
function inner()
    array_1d[3]
end
function outer()
    inner()
end
outer()

produces:

ERROR: BoundsError()
 in outer at /home/alex/test2.jl:8
 in include_from_node1 at loading.jl:120
while loading /home/alex/test2.jl, in expression starting on line 10

Here I lose inner() but get outer() in the backtrace.
Finally, if I wrap the array index inside a for loop, I get the full 
backtrace:

array_1d = [1,2]
function inner()
    for i in 1:1000
        array_1d[3]
    end 
end
function outer()
    inner()
end
outer()

produces:

ERROR: BoundsError()
 in inner at /home/alex/test3.jl:6
 in outer at /home/alex/test3.jl:10
 in include_from_node1 at loading.jl:120
while loading /home/alex/test3.jl, in expression starting on line 12

o_O

Reply via email to