<p dir="auto">I got this while trying to overwrite the <code class="notranslate">getindex</code> function in <a href="https://github.com/QuantumBFS/BitBasis.jl">BitBasis.jl</a>, it can be re-produced by the following code</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="using BitBasis

struct SubBit{T, L}
    parent::BitStr{T, L}
    index::Int
end

Base.getindex(x::BitStr, index::Int) = SubBit(x, index)"><pre class="notranslate"><span class="pl-k">using</span> BitBasis

<span class="pl-k">struct</span> SubBit{T, L}
    parent<span class="pl-k">::</span><span class="pl-c1">BitStr{T, L}</span>
    index<span class="pl-k">::</span><span class="pl-c1">Int</span>
<span class="pl-k">end</span>

Base<span class="pl-k">.</span><span class="pl-en">getindex</span>(x<span class="pl-k">::</span><span class="pl-c1">BitStr</span>, index<span class="pl-k">::</span><span class="pl-c1">Int</span>) <span class="pl-k">=</span> <span class="pl-c1">SubBit</span>(x, index)</pre></div>
<p dir="auto">Then type</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="bit&quot;101&quot;[1]"><pre class="notranslate"><span class="pl-s"><span class="pl-pds"><span class="pl-c1">bit</span>"</span>101<span class="pl-pds">"</span></span>[<span class="pl-c1">1</span>]</pre></div>
<p dir="auto">in REPL will get this segmentation fault. Not sure why, if I remove the overloading of <code class="notranslate">getindex</code> inside <code class="notranslate">BitBasis</code> then it is fine.</p>
<p dir="auto"><strong>versioninfo</strong></p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.5.0)
  CPU: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = code"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">versioninfo</span>()
Julia Version <span class="pl-c1">1.1</span>.<span class="pl-c1">0</span>
Commit <span class="pl-c1">80516</span>ca202 (<span class="pl-c1">2019</span><span class="pl-k">-</span><span class="pl-c1">01</span><span class="pl-k">-</span><span class="pl-c1">21</span> <span class="pl-c1">21</span><span class="pl-k">:</span><span class="pl-c1">24</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>darwin18.<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">7700</span>HQ CPU @ <span class="pl-c1">2.80</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">1</span> (ORCJIT, skylake)
Environment<span class="pl-k">:</span>
  JULIA_EDITOR <span class="pl-k">=</span> code</pre></div>
<p dir="auto">The following recursively nested exception handling causes a segfault on linux x86_64, with <em>both</em> julia 0.6 and julia 1.0.  This seems to happen at the boundary of a stack overflow, as it's fine for all <code class="notranslate">n &lt; 27542</code> on my system, and seems to segfault above that.</p>
<p dir="auto">This could be related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="162287690" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/17109" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/17109/hovercard" href="https://github.com/JuliaLang/julia/issues/17109">#17109</a>, though running the first example code from that issue works fine for me.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@noinline boom() = error(&quot;Boom&quot;)

function evil(n)
    if n == 0 
        return 1
    end
    try
        evil(n-1)
    catch
        boom()
    end
end

evil(1000000)"><pre class="notranslate"><span class="pl-c1">@noinline</span> <span class="pl-en">boom</span>() <span class="pl-k">=</span> <span class="pl-c1">error</span>(<span class="pl-s"><span class="pl-pds">"</span>Boom<span class="pl-pds">"</span></span>)

<span class="pl-k">function</span> <span class="pl-en">evil</span>(n)
    <span class="pl-k">if</span> n <span class="pl-k">==</span> <span class="pl-c1">0</span> 
        <span class="pl-k">return</span> <span class="pl-c1">1</span>
    <span class="pl-k">end</span>
    <span class="pl-k">try</span>
        <span class="pl-c1">evil</span>(n<span class="pl-k">-</span><span class="pl-c1">1</span>)
    <span class="pl-k">catch</span>
        <span class="pl-c1">boom</span>()
    <span class="pl-k">end</span>
<span class="pl-k">end</span>

<span class="pl-c1">evil</span>(<span class="pl-c1">1000000</span>)</pre></div>
<p dir="auto">To be clear, I didn't find this in real code - it's an intentional stress test for a WIP fix for <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="200094192" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/19979" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/19979/hovercard" href="https://github.com/JuliaLang/julia/issues/19979">#19979</a>.</p>