<p dir="auto">I just stumbled upon an illegal instruction while redefining a function called with splatting, under some peculiar conditions. Here is a minimal test case:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="b = 1
v = (1,)

# type annotation for A (but not the actual type) is necessary to trigger the bug
# the return value is not important
f(A::Any, I1) = 1

# the splatting is necessary to trigger the bug
# two calls are needed
f(b, v...)
f(b, v...)

f(A::Any, I1) = error()

# the for loop is required to trigger the bug
for i = 1;  f(b, v...); end"><pre class="notranslate">b <span class="pl-k">=</span> <span class="pl-c1">1</span>
v <span class="pl-k">=</span> (<span class="pl-c1">1</span>,)

<span class="pl-c"><span class="pl-c">#</span> type annotation for A (but not the actual type) is necessary to trigger the bug</span>
<span class="pl-c"><span class="pl-c">#</span> the return value is not important</span>
<span class="pl-en">f</span>(A<span class="pl-k">::</span><span class="pl-c1">Any</span>, I1) <span class="pl-k">=</span> <span class="pl-c1">1</span>

<span class="pl-c"><span class="pl-c">#</span> the splatting is necessary to trigger the bug</span>
<span class="pl-c"><span class="pl-c">#</span> two calls are needed</span>
<span class="pl-c1">f</span>(b, v<span class="pl-k">...</span>)
<span class="pl-c1">f</span>(b, v<span class="pl-k">...</span>)

<span class="pl-en">f</span>(A<span class="pl-k">::</span><span class="pl-c1">Any</span>, I1) <span class="pl-k">=</span> <span class="pl-c1">error</span>()

<span class="pl-c"><span class="pl-c">#</span> the for loop is required to trigger the bug</span>
<span class="pl-k">for</span> i <span class="pl-k">=</span> <span class="pl-c1">1</span>;  <span class="pl-c1">f</span>(b, v<span class="pl-k">...</span>); <span class="pl-k">end</span></pre></div>
<p dir="auto">The output is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="WARNING: Method definition f(Any, Any) in module Main at /home/carlo/Programs/julia/bug.jl:6 overwritten at /home/carlo/Programs/julia/bug.jl:13.

signal (4): Illegal instruction
while loading /home/carlo/Programs/julia/bug.jl, in expression starting on line 16
macro expansion; at /home/carlo/Programs/julia/bug.jl:16
unknown function (ip: 0x7f6df02bc87f)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
jl_parse_eval_all at /home/carlo/Programs/julia/src/ast.c:699
jl_load at /home/carlo/Programs/julia/src/toplevel.c:569
include_from_node1 at ./loading.jl:426
unknown function (ip: 0x7f70070fa13c)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
do_call at /home/carlo/Programs/julia/src/interpreter.c:65
eval at /home/carlo/Programs/julia/src/interpreter.c:188
jl_toplevel_eval_flex at /home/carlo/Programs/julia/src/toplevel.c:529
jl_toplevel_eval_in_warn at /home/carlo/Programs/julia/src/builtins.c:571
eval at ./boot.jl:231
unknown function (ip: 0x7f70070e07d0)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
eval_user_input at ./REPL.jl:62
unknown function (ip: 0x7f6df02bc5b6)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
macro expansion; at ./REPL.jl:92
unknown function (ip: 0x7f6df02b8c8f)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
jl_apply at /home/carlo/Programs/julia/src/julia.h:1388
unknown function (ip: 0xffffffffffffffff)
Allocations: 4248296 (Pool: 4247549; Big: 747); GC: 9
Illegal instruction (core dumped)"><pre class="notranslate"><code class="notranslate">WARNING: Method definition f(Any, Any) in module Main at /home/carlo/Programs/julia/bug.jl:6 overwritten at /home/carlo/Programs/julia/bug.jl:13.

signal (4): Illegal instruction
while loading /home/carlo/Programs/julia/bug.jl, in expression starting on line 16
macro expansion; at /home/carlo/Programs/julia/bug.jl:16
unknown function (ip: 0x7f6df02bc87f)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
jl_parse_eval_all at /home/carlo/Programs/julia/src/ast.c:699
jl_load at /home/carlo/Programs/julia/src/toplevel.c:569
include_from_node1 at ./loading.jl:426
unknown function (ip: 0x7f70070fa13c)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
do_call at /home/carlo/Programs/julia/src/interpreter.c:65
eval at /home/carlo/Programs/julia/src/interpreter.c:188
jl_toplevel_eval_flex at /home/carlo/Programs/julia/src/toplevel.c:529
jl_toplevel_eval_in_warn at /home/carlo/Programs/julia/src/builtins.c:571
eval at ./boot.jl:231
unknown function (ip: 0x7f70070e07d0)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
eval_user_input at ./REPL.jl:62
unknown function (ip: 0x7f6df02bc5b6)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
macro expansion; at ./REPL.jl:92
unknown function (ip: 0x7f6df02b8c8f)
jl_call_method_internal at /home/carlo/Programs/julia/src/julia_internal.h:86
jl_apply at /home/carlo/Programs/julia/src/julia.h:1388
unknown function (ip: 0xffffffffffffffff)
Allocations: 4248296 (Pool: 4247549; Big: 747); GC: 9
Illegal instruction (core dumped)
</code></pre></div>
<p dir="auto">This is on:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Julia Version 0.5.0-dev+4882
Commit 3aafa05* (2016-06-21 12:36 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)"><pre class="notranslate"><code class="notranslate">Julia Version 0.5.0-dev+4882
Commit 3aafa05* (2016-06-21 12:36 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)
</code></pre></div>
<p dir="auto">I found that sometimes function overwriting does not work right away. The method redefinition warning gets triggered, but the old function definition is used.<br>
Here is a minimal test case which shows the bug (the last call fails, but calling <code class="notranslate">f()</code> again then produces <code class="notranslate">2</code> as expected):</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="f() = 1

# at least two calls are required to trigger the bug
f()
f()

f() = 2

@assert f() == 2 # fails"><pre class="notranslate"><span class="pl-en">f</span>() <span class="pl-k">=</span> <span class="pl-c1">1</span>

<span class="pl-c"><span class="pl-c">#</span> at least two calls are required to trigger the bug</span>
<span class="pl-c1">f</span>()
<span class="pl-c1">f</span>()

<span class="pl-en">f</span>() <span class="pl-k">=</span> <span class="pl-c1">2</span>

<span class="pl-c1">@assert</span> <span class="pl-c1">f</span>() <span class="pl-k">==</span> <span class="pl-c1">2</span> <span class="pl-c"><span class="pl-c">#</span> fails</span></pre></div>
<p dir="auto">This is on version <code class="notranslate">0.5.0-dev+4882</code>.</p>