<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; using LinearAlgebra

julia&gt; @which Matrix(Diagonal(rand(3)))
(::Type{Array{T,2} where T})(D::Diagonal) in LinearAlgebra at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v0.7/LinearAlgebra/src/diagonal.jl:56

julia&gt; versioninfo()
Julia Version 0.7.0-beta.201
Commit cdd4e84ac9 (2018-07-07 22:13 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, ivybridge)"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-k">using</span> LinearAlgebra

julia<span class="pl-k">&gt;</span> <span class="pl-c1">@which</span> <span class="pl-c1">Matrix</span>(<span class="pl-c1">Diagonal</span>(<span class="pl-c1">rand</span>(<span class="pl-c1">3</span>)))
(<span class="pl-k">::</span><span class="pl-c1">Type{Array{T,2} where T}</span>)(D<span class="pl-k">::</span><span class="pl-c1">Diagonal</span>) <span class="pl-k">in</span> LinearAlgebra at <span class="pl-k">/</span>Users<span class="pl-k">/</span>osx<span class="pl-k">/</span>buildbot<span class="pl-k">/</span>slave<span class="pl-k">/</span>package_osx64<span class="pl-k">/</span>build<span class="pl-k">/</span>usr<span class="pl-k">/</span>share<span class="pl-k">/</span>julia<span class="pl-k">/</span>stdlib<span class="pl-k">/</span>v0.<span class="pl-c1">7</span><span class="pl-k">/</span>LinearAlgebra<span class="pl-k">/</span>src<span class="pl-k">/</span>diagonal<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">56</span>

julia<span class="pl-k">&gt;</span> <span class="pl-c1">versioninfo</span>()
Julia Version <span class="pl-c1">0.7</span>.<span class="pl-c1">0</span><span class="pl-k">-</span>beta.<span class="pl-c1">201</span>
Commit cdd4e84ac9 (<span class="pl-c1">2018</span><span class="pl-k">-</span><span class="pl-c1">07</span><span class="pl-k">-</span><span class="pl-c1">07</span> <span class="pl-c1">22</span><span class="pl-k">:</span><span class="pl-c1">13</span> UTC)
Platform Info<span class="pl-k">:</span>
  OS<span class="pl-k">:</span> macOS (x86_64<span class="pl-k">-</span>apple<span class="pl-k">-</span>darwin14.<span class="pl-c1">5.0</span>)
  CPU<span class="pl-k">:</span> <span class="pl-c1">Intel</span>(R) <span class="pl-c1">Core</span>(TM) i7<span class="pl-k">-</span><span class="pl-c1">3820</span>QM CPU @ <span class="pl-c1">2.70</span>GHz
  WORD_SIZE<span class="pl-k">:</span> <span class="pl-c1">64</span>
  LIBM<span class="pl-k">:</span> libopenlibm
  LLVM<span class="pl-k">:</span> libLLVM<span class="pl-k">-</span><span class="pl-c1">6.0</span>.<span class="pl-c1">0</span> (ORCJIT, ivybridge)</pre></div>
<p dir="auto">Seems to be two, possibly disjoint problems observed here:</p>
<ol dir="auto">
<li>"repeated 387 more times" and the immediately subsequent "repeated 166 more times" are precisely the same stacktrace</li>
<li>the interpreter duplicates <code class="notranslate">f28442</code> on the callstack</li>
</ol>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ ./julia --compile=min -q
julia&gt; begin
           f28442(c) = g28442(c + 1)
           g28442(c) = c &gt; 2000 ? (return backtrace()) : f28442(c + 1)
           bt = f28442(1)
           Base.show_backtrace(stdout, bt)
       end

Stacktrace:
 [1] g28442(::Int64) at REPL[0]:3
 [2] f28442(::Int64) at REPL[0]:2
 ... (the last 2 lines are repeated 442 more times)
 [887] g28442(::Int64) at REPL[0]:3
 [888] f28442(::Int64) at REPL[0]:2 (repeats 2 times)
 [889] g28442(::Int64) at REPL[0]:3
 ... (the last 2 lines are repeated 387 more times)
 [1664] f28442(::Int64) at REPL[0]:2 (repeats 2 times)
 [1665] g28442(::Int64) at REPL[0]:3
 ... (the last 2 lines are repeated 166 more times)
 [1998] f28442(::Int64) at REPL[0]:2
 [1999] top-level scope at REPL[0]:4
 [2000] eval(::Module, ::Any) at ./boot.jl:319
 [2001] eval_user_input(::Any, ::REPL.REPLBackend) at REPL.jl:85
 [2002] macro expansion at REPL.jl:117 [inlined]"><pre class="notranslate"><span class="pl-k">$</span> <span class="pl-k">./</span>julia <span class="pl-k">--</span>compile<span class="pl-k">=</span>min <span class="pl-k">-</span>q
julia<span class="pl-k">&gt;</span> <span class="pl-k">begin</span>
           <span class="pl-en">f28442</span>(c) <span class="pl-k">=</span> <span class="pl-c1">g28442</span>(c <span class="pl-k">+</span> <span class="pl-c1">1</span>)
           <span class="pl-en">g28442</span>(c) <span class="pl-k">=</span> c <span class="pl-k">&gt;</span> <span class="pl-c1">2000</span> <span class="pl-k">?</span> (<span class="pl-k">return</span> <span class="pl-c1">backtrace</span>()) <span class="pl-k">:</span> <span class="pl-c1">f28442</span>(c <span class="pl-k">+</span> <span class="pl-c1">1</span>)
           bt <span class="pl-k">=</span> <span class="pl-c1">f28442</span>(<span class="pl-c1">1</span>)
           Base<span class="pl-k">.</span><span class="pl-c1">show_backtrace</span>(<span class="pl-c1">stdout</span>, bt)
       <span class="pl-k">end</span>

Stacktrace<span class="pl-k">:</span>
 [<span class="pl-c1">1</span>] <span class="pl-c1">g28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">3</span>
 [<span class="pl-c1">2</span>] <span class="pl-c1">f28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">2</span>
 <span class="pl-k">...</span> (the last <span class="pl-c1">2</span> lines are repeated <span class="pl-c1">442</span> more times)
 [<span class="pl-c1">887</span>] <span class="pl-c1">g28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">3</span>
 [<span class="pl-c1">888</span>] <span class="pl-c1">f28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">2</span> (repeats <span class="pl-c1">2</span> times)
 [<span class="pl-c1">889</span>] <span class="pl-c1">g28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">3</span>
 <span class="pl-k">...</span> (the last <span class="pl-c1">2</span> lines are repeated <span class="pl-c1">387</span> more times)
 [<span class="pl-c1">1664</span>] <span class="pl-c1">f28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">2</span> (repeats <span class="pl-c1">2</span> times)
 [<span class="pl-c1">1665</span>] <span class="pl-c1">g28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">3</span>
 <span class="pl-k">...</span> (the last <span class="pl-c1">2</span> lines are repeated <span class="pl-c1">166</span> more times)
 [<span class="pl-c1">1998</span>] <span class="pl-c1">f28442</span>(<span class="pl-k">::</span><span class="pl-c1">Int64</span>) at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">2</span>
 [<span class="pl-c1">1999</span>] top<span class="pl-k">-</span>level scope at REPL[<span class="pl-c1">0</span>]<span class="pl-k">:</span><span class="pl-c1">4</span>
 [<span class="pl-c1">2000</span>] <span class="pl-c1">eval</span>(<span class="pl-k">::</span><span class="pl-c1">Module</span>, <span class="pl-k">::</span><span class="pl-c1">Any</span>) at <span class="pl-k">./</span>boot<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">319</span>
 [<span class="pl-c1">2001</span>] <span class="pl-c1">eval_user_input</span>(<span class="pl-k">::</span><span class="pl-c1">Any</span>, <span class="pl-k">::</span><span class="pl-c1">REPL.REPLBackend</span>) at REPL<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">85</span>
 [<span class="pl-c1">2002</span>] <span class="pl-k">macro</span> expansion at REPL<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">117</span> [inlined]</pre></div>