Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: internal compiler error: out of fixed registers (on 386) #16810

Closed
calmh opened this issue Aug 20, 2016 · 4 comments
Closed

cmd/compile: internal compiler error: out of fixed registers (on 386) #16810

calmh opened this issue Aug 20, 2016 · 4 comments

Comments

@calmh
Copy link
Contributor

calmh commented Aug 20, 2016

Go 1.7, compiling this package:

package weakhash

type digest struct {
    buf  []byte
    size int
    a    uint16
    b    uint16
    j    int
}

func (d *digest) Write(data []byte) (int, error) {
    for _, c := range data {
        d.a = d.a - uint16(d.buf[d.j]) + uint16(c)
        d.b = d.b - uint16(d.size)*uint16(d.buf[d.j]) + d.a
        d.buf[d.j] = c
        d.j = (d.j + 1) % d.size
    }
    return len(data), nil
}

results in

jb@syno:~/t/weakhash $ go version
go version go1.7rc6 darwin/amd64
jb@syno:~/t/weakhash $ GOARCH=386 go build
# _/Users/jb/test/weakhash
run compiler with -v for register allocation sites
./weakhash.go:13: internal compiler error: out of fixed registers

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
    /usr/local/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0x4ff9fa, 0x16, 0x0, 0x0, 0x0)
    /usr/local/go/src/cmd/compile/internal/gc/subr.go:165 +0x248
cmd/compile/internal/gc.Regalloc(0xc42044b320, 0xc420014c30, 0xc42044b200)
    /usr/local/go/src/cmd/compile/internal/gc/gsubr.go:749 +0x16b
cmd/compile/internal/x86.ginscmp(0xc42042183e, 0xc420014c30, 0xc42044b0e0, 0xc42044b200, 0x1, 0x0)
    /usr/local/go/src/cmd/compile/internal/x86/gsubr.go:657 +0x364
cmd/compile/internal/gc.Agenr(0xc4204219e0, 0xc42044aa20, 0xc42044a7e0)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:1245 +0x20e8
cmd/compile/internal/gc.Igen(0xc4204219e0, 0xc42044aa20, 0xc42044a7e0)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:1718 +0x279
cmd/compile/internal/gc.cgen_wb(0xc4204219e0, 0xc42044a7e0, 0xc42040ef00)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:523 +0x2281
cmd/compile/internal/gc.Cgen(0xc4204219e0, 0xc42044a7e0)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:19 +0x3a
cmd/compile/internal/gc.Mgen(0xc4204219e0, 0xc42044a7e0, 0xc42044a750)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:906 +0xf7
cmd/compile/internal/gc.cgen_wb(0xc420421a70, 0xc42044a750, 0x0)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:460 +0x1c95
cmd/compile/internal/gc.Cgen(0xc420421a70, 0xc42044a750)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:19 +0x3a
cmd/compile/internal/gc.cgen_wb(0xc420421b00, 0xc42044a510, 0xc42040ef00)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:738 +0x1045
cmd/compile/internal/gc.Cgen(0xc420421b00, 0xc42044a510)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:19 +0x3a
cmd/compile/internal/gc.cgen_wb(0xc420421cb0, 0xc42044a360, 0x0)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:725 +0xe4c
cmd/compile/internal/gc.Cgen(0xc420421cb0, 0xc42044a360)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:19 +0x3a
cmd/compile/internal/gc.cgen_wb(0xc420421cb0, 0xc420421710, 0x4ef400)
    /usr/local/go/src/cmd/compile/internal/gc/cgen.go:102 +0x427d
cmd/compile/internal/gc.Cgen_as_wb(0xc420421710, 0xc420421cb0, 0xd00000800)
    /usr/local/go/src/cmd/compile/internal/gc/gen.go:1023 +0x17b
cmd/compile/internal/gc.Cgen_as(0xc420421710, 0xc420421cb0)
    /usr/local/go/src/cmd/compile/internal/gc/gen.go:979 +0x3a
cmd/compile/internal/gc.gen(0xc420421d40)
    /usr/local/go/src/cmd/compile/internal/gc/gen.go:926 +0xd6c
cmd/compile/internal/gc.Genlist(0xc4204244c0)
    /usr/local/go/src/cmd/compile/internal/gc/gen.go:311 +0x50
cmd/compile/internal/gc.gen(0xc420421560)
    /usr/local/go/src/cmd/compile/internal/gc/gen.go:860 +0x62f
cmd/compile/internal/gc.Genlist(0xc420424400)
    /usr/local/go/src/cmd/compile/internal/gc/gen.go:311 +0x50
cmd/compile/internal/gc.genlegacy(0xc4200ec278, 0xc42042c8c0, 0xc42042c930)
    /usr/local/go/src/cmd/compile/internal/gc/pgen.go:498 +0x4d
cmd/compile/internal/gc.compile(0xc4204210e0)
    /usr/local/go/src/cmd/compile/internal/gc/pgen.go:485 +0x7a4
cmd/compile/internal/gc.funccompile(0xc4204210e0)
    /usr/local/go/src/cmd/compile/internal/gc/dcl.go:1287 +0x186
cmd/compile/internal/gc.Main()
    /usr/local/go/src/cmd/compile/internal/gc/main.go:467 +0x19f8
cmd/compile/internal/x86.Main()
    /usr/local/go/src/cmd/compile/internal/x86/galign.go:80 +0x3ba
main.main()
    /usr/local/go/src/cmd/compile/main.go:31 +0x1d4
@calmh
Copy link
Contributor Author

calmh commented Aug 20, 2016

It does so in 1.6.3 as well, so this is not a regression at least.

@odeke-em
Copy link
Member

Duplicate of just closed issue #13277. @bradfitz perhaps you could chime in on how @calmh can get the latest so that this bug doesn't resurface for them?

@calmh
Copy link
Contributor Author

calmh commented Aug 20, 2016

Right, ok.

@calmh calmh closed this as completed Aug 20, 2016
@bradfitz
Copy link
Contributor

Well, you can update to Go tip (what will become Go 1.8) but it's super early days right now so no guarantees of stability. Tread carefully.

@golang golang locked and limited conversation to collaborators Aug 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants