# Compiling to branch table

**URL:** <https://discourse.julialang.org/t/compiling-to-branch-table/16599>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 21, 2018, 1:12pm UTC](https://discourse.julialang.org/t/compiling-to-branch-table/16599 "2018-10-21T13:12:54Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Stephen\_Vavasis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephen_vavasis/32/3389_2.png) [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Post date:** [October 22, 2018, 12:43am UTC](https://discourse.julialang.org/t/compiling-to-branch-table/16599/11 "2018-10-22T00:43:49Z")

</div>

Last year, poring over the output of `@code_native` I discovered that my code of the form

```julia
    if i == 1
        dothis()
    elseif i == 2
        dotheother()
    elseif i == 3
        dothethirdthing()
    end

```

was in fact compiling to a jump-table. (This was causing a bug in my program because there was an error in LLVM address computation. That LLVM bug has been fixed, I believe.) Here is the old thread:

> [@Match LLVM with Julia source?](https://discourse.julialang.org/t/match-llvm-with-julia-source/9017/3):
>
> Thanks for the help! Using these techniques plus poring over GDB, I have tracked down the exact location of the ReadOnlyMemoryError() in my code, but I still don’t know what is causing it. It appears to be a bug either in the Julia run-time system or the LLVM run-time system. My code (0.6.2) looks like this: if whichderiv == -1 [snip] elseif whichderiv == 0 [snip] elseif whichderiv == 1 [snip] els…

---

_[View the full topic](https://discourse.julialang.org/t/compiling-to-branch-table/16599)._
