<p dir="auto">go version devel +7be32d0 Wed Mar 4 18:24:53 2015 +0000 linux/amd64</p>
<p dir="auto">The following program crashes compiler with "internal compiler error: out of fixed registers" on amd64 and arm but not on 386.</p>
<div class="highlight highlight-source-go notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package main
func main() {
    type X struct {
        f int
    }
    var x X
    var xx []X
    var s0 []int
    var s1 []func()
    var s2 [][][]int
    var s3 [][]int
    var s4 [][]int16
    s1[xx[int(s4[0][s0[s3[s0[s2[s3[s0[s0[s0[x.f]]-1]+1][0]-1][0][0]]-1][0]]+1])].f-1]() 
}"><pre class="notranslate"><span class="pl-k">package</span> main
<span class="pl-k">func</span> <span class="pl-en">main</span>() {
    <span class="pl-k">type</span> <span class="pl-smi">X</span> <span class="pl-k">struct</span> {
        <span class="pl-c1">f</span> <span class="pl-smi">int</span>
    }
    <span class="pl-k">var</span> <span class="pl-s1">x</span> <span class="pl-smi">X</span>
    <span class="pl-k">var</span> <span class="pl-s1">xx</span> []<span class="pl-smi">X</span>
    <span class="pl-k">var</span> <span class="pl-s1">s0</span> []<span class="pl-smi">int</span>
    <span class="pl-k">var</span> <span class="pl-s1">s1</span> []<span class="pl-k">func</span>()
    <span class="pl-k">var</span> <span class="pl-s1">s2</span> [][][]<span class="pl-smi">int</span>
    <span class="pl-k">var</span> <span class="pl-s1">s3</span> [][]<span class="pl-smi">int</span>
    <span class="pl-k">var</span> <span class="pl-s1">s4</span> [][]<span class="pl-smi">int16</span>
    <span class="pl-s1">s1</span>[<span class="pl-s1">xx</span>[<span class="pl-en">int</span>(<span class="pl-s1">s4</span>[<span class="pl-c1">0</span>][<span class="pl-s1">s0</span>[<span class="pl-s1">s3</span>[<span class="pl-s1">s0</span>[<span class="pl-s1">s2</span>[<span class="pl-s1">s3</span>[<span class="pl-s1">s0</span>[<span class="pl-s1">s0</span>[<span class="pl-s1">s0</span>[<span class="pl-s1">x</span>.<span class="pl-c1">f</span>]]<span class="pl-c1">-</span><span class="pl-c1">1</span>]<span class="pl-c1">+</span><span class="pl-c1">1</span>][<span class="pl-c1">0</span>]<span class="pl-c1">-</span><span class="pl-c1">1</span>][<span class="pl-c1">0</span>][<span class="pl-c1">0</span>]]<span class="pl-c1">-</span><span class="pl-c1">1</span>][<span class="pl-c1">0</span>]]<span class="pl-c1">+</span><span class="pl-c1">1</span>])].<span class="pl-c1">f</span><span class="pl-c1">-</span><span class="pl-c1">1</span>]() 
}</pre></div>
<pre class="notranslate">1. What is a short input program that triggers the error?

<a href="http://play.golang.org/p/m59dvc6cXo" rel="nofollow">http://play.golang.org/p/m59dvc6cXo</a>

Also a reduced example:

package main

type T struct {
    F int
}

func f() {
    var (
        A = [][1]int{}
        B = []int{3: 1, 4: 1}
        X [2]byte
        Y [2]int
        Z []float64
        n int

        S     []T
        Funcs = [0]func() uintptr{}
    )

    var Var813 = Funcs[int(B[Y[S[A[X[int(Z[n])]-1][n]+1].F+1]])]()

        _ = Var813
}

2. What is the full compiler output?

0 0
1 0
2 0
3 40cee6
4 0
5 40a25c
6 0
7 0
8 40a25c
9 412470
10 40a25c
11 40a25c
12 40a25c
13 40999d
14 40ab97
15 40a2f5
bug1.go:20: internal compiler error: out of fixed registers


3. What version of the compiler are you using?  (Run it with the -V flag.)

go version devel +0a0e0c40901d Tue Jul 08 14:47:52 2014 -0400 linux/amd64</pre>