# Splatting causes BoundsError in 0.7-alpha

**URL:** <https://discourse.julialang.org/t/splatting-causes-boundserror-in-0-7-alpha/11653>\
**Category:** General Usage\
**Tags:** bug, error\
**Created:** [June 13, 2018, 4:09pm UTC](https://discourse.julialang.org/t/splatting-causes-boundserror-in-0-7-alpha/11653 "2018-06-13T16:09:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksmcreynolds](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ksmcreynolds/32/860_2.png) [@ksmcreynolds](https://discourse.julialang.org/u/ksmcreynolds)\
**Post date:** [June 13, 2018, 4:09pm UTC](https://discourse.julialang.org/t/splatting-causes-boundserror-in-0-7-alpha/11653/1 "2018-06-13T16:09:43Z")

</div>

I get a weird `BoundsError` when I use splatting in v0.7-alpha. Below is a MWE.

```julia
function test(a,b)
    c = (b,(0,1)...)
    test(a, c...)
end
    
function test2(a,b)
    c = (b,0,1)
    test(a, c...)
end

test(a, b, c, d) = a.*(b, c, d)

```

Calling `test2(1,1)` works as expected returning `(1, 0, 1)`. Running `test(1,1)` however gives the following

```julia
Internal error: encountered unexpected error in runtime:
BoundsError(a=Array{Any, (6,)}[
  Tuple{Int64},
  Core.Compiler.Const(val=(0, 1), actual=false),
  Tuple{Int64, Int64, Int64},
  Tuple{Int64},
  Tuple{Int64, Int64, Int64},
  Any], i=(7,))
rec_backtrace at julia/src/stackwalk.c:94
record_backtrace at julia/src/task.c:246 [inlined]
jl_throw at julia/src/task.c:577
jl_bounds_error_ints at julia/src/rtutils.c:187
getindex at ./array.jl:707
abstract_eval_ssavalue at ./compiler/ssair/queries.jl:60 [inlined]
exprtype at ./compiler/utilities.jl:183 [inlined]
assemble_inline_todo! at ./compiler/ssair/inlining2.jl:801
ssa_inlining_pass! at ./compiler/ssair/inlining2.jl:54 [inlined]
run_passes at ./compiler/ssair/driver.jl:168
optimize at ./compiler/optimize.jl:183
typeinf at ./compiler/typeinfer.jl:436
typeinf_frame at ./compiler/typeinfer.jl:96 [inlined]
typeinf_code at ./compiler/typeinfer.jl:191
typeinf_ext at ./compiler/typeinfer.jl:233
jfptr_typeinf_ext_12 at julia/usr/lib/julia/sys.dylib (unknown line)
jl_apply at julia/src/./julia.h:1540 [inlined]
jl_apply_with_saved_exception_state at julia/src/rtutils.c:257
jl_type_infer at julia/src/gf.c:274
jl_compile_method_internal at julia/src/gf.c:1778
jl_fptr_trampoline at julia/src/gf.c:1822
do_call at julia/src/interpreter.c:324
eval_body at julia/src/interpreter.c:559
jl_interpret_toplevel_thunk_callback at julia/src/interpreter.c:798
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x11307df8f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at julia/src/interpreter.c:807
jl_toplevel_eval_flex at julia/src/toplevel.c:856
jl_toplevel_eval_in at julia/src/builtins.c:631
eval at ./boot.jl:316
eval_user_input at julia/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:85
macro expansion at julia/usr/share/julia/stdlib/v0.7/REPL/src/REPL.jl:116 [inlined]
#28 at ./task.jl:254
jl_fptr_trampoline at julia/src/gf.c:1823
jl_apply at julia/src/./julia.h:1540 [inlined]
start_task at julia/src/task.c:268
(1, 0, 1)

```

The weirdest part is that it still gives the correct output at the end. . .

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [June 13, 2018, 4:40pm UTC](https://discourse.julialang.org/t/splatting-causes-boundserror-in-0-7-alpha/11653/2 "2018-06-13T16:40:15Z")

</div>

Seems like a compiler bug. Would you mind filing an issue?

---

<div class="post-metadata">

**Author:** ![ksmcreynolds](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ksmcreynolds/32/860_2.png) [@ksmcreynolds](https://discourse.julialang.org/u/ksmcreynolds)\
**Post date:** [June 13, 2018, 11:32pm UTC](https://discourse.julialang.org/t/splatting-causes-boundserror-in-0-7-alpha/11653/3 "2018-06-13T23:32:58Z")

</div>

[Issue #27566](https://github.com/JuliaLang/julia/issues/27566) posted.
