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: compiler panic in ssa.tighten #19312

Closed
unclejack opened this issue Feb 28, 2017 · 3 comments
Closed

cmd/compile: compiler panic in ssa.tighten #19312

unclejack opened this issue Feb 28, 2017 · 3 comments
Milestone

Comments

@unclejack
Copy link
Contributor

unclejack commented Feb 28, 2017

What version of Go are you using (go version)?

go version go1.7.5 linux/amd64

Go was installed from the official amd64 tarball.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN="/opt/gopath/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/opt/gopath"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build786142980=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I was compiling a project.

What did you expect to see?

I was expecting to see Go compile that project.

What did you see instead?

runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc424140d08, 0xc42325c0f0)
        /usr/local/go/src/cmd/compile/internal/ssa/compile.go:35 +0xc8
panic(0x8b82c0, 0xc42000e140)
        /usr/local/go/src/runtime/panic.go:458 +0x243
cmd/compile/internal/ssa.tighten(0xc42325c0f0)
        /usr/local/go/src/cmd/compile/internal/ssa/tighten.go:19 +0x64
cmd/compile/internal/ssa.Compile(0xc42325c0f0)
        /usr/local/go/src/cmd/compile/internal/ssa/compile.go:64 +0x321
cmd/compile/internal/gc.buildssa(0xc422a6c1b0, 0x0)
        /usr/local/go/src/cmd/compile/internal/gc/ssa.go:232 +0xc5f
cmd/compile/internal/gc.compile(0xc422a6c1b0)
        /usr/local/go/src/cmd/compile/internal/gc/pgen.go:405 +0x1377
cmd/compile/internal/gc.funccompile(0xc422a6c1b0)
        /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/amd64.Main()
        /usr/local/go/src/cmd/compile/internal/amd64/galign.go:93 +0x2fa
main.main()
        /usr/local/go/src/cmd/compile/main.go:33 +0x2a3



goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /usr/local/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0x90bf1b, 0x2c, 0xc423db3c40, 0x4, 0x4)
        /usr/local/go/src/cmd/compile/internal/gc/subr.go:165 +0x248
cmd/compile/internal/gc.(*ssaExport).Fatalf(0xb60d46, 0xbff, 0x90bf1b, 0x2c, 0xc423db3c40, 0x4, 0x4)
        /usr/local/go/src/cmd/compile/internal/gc/ssa.go:4437 +0x74
cmd/compile/internal/ssa.(*Config).Fatalf(0xc422f52000, 0xc400000bff, 0x90bf1b, 0x2c, 0xc423db3c40, 0x4, 0x4)
        /usr/local/go/src/cmd/compile/internal/ssa/config.go:200 +0x6e
cmd/compile/internal/ssa.(*Func).Fatalf(0xc42325c0f0, 0x90bf1b, 0x2c, 0xc423db3c40, 0x4, 0x4)
        /usr/local/go/src/cmd/compile/internal/ssa/func.go:397 +0x6b
cmd/compile/internal/ssa.Compile.func1(0xc424140d08, 0xc42325c0f0)
        /usr/local/go/src/cmd/compile/internal/ssa/compile.go:37 +0x25b
panic(0x8b82c0, 0xc42000e140)
        /usr/local/go/src/runtime/panic.go:458 +0x243
cmd/compile/internal/ssa.tighten(0xc42325c0f0)
        /usr/local/go/src/cmd/compile/internal/ssa/tighten.go:19 +0x64
cmd/compile/internal/ssa.Compile(0xc42325c0f0)
        /usr/local/go/src/cmd/compile/internal/ssa/compile.go:64 +0x321
cmd/compile/internal/gc.buildssa(0xc422a6c1b0, 0x0)
        /usr/local/go/src/cmd/compile/internal/gc/ssa.go:232 +0xc5f
cmd/compile/internal/gc.compile(0xc422a6c1b0)
        /usr/local/go/src/cmd/compile/internal/gc/pgen.go:405 +0x1377
cmd/compile/internal/gc.funccompile(0xc422a6c1b0)
        /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/amd64.Main()
        /usr/local/go/src/cmd/compile/internal/amd64/galign.go:93 +0x2fa
main.main()
        /usr/local/go/src/cmd/compile/main.go:33 +0x2a3

There was also something related to SSA tighthen pass at the top. I couldn't reproduce the issue to get that message again or this error above.

I've opened this issue in case there's some underlying bug. Please feel free to close this right away if it's a known issue or a duplicate.

@ianlancetaylor ianlancetaylor changed the title cmd/compile: tighten related panic cmd/compile: compiler panic in ssa.tighten Feb 28, 2017
@ianlancetaylor ianlancetaylor added this to the Go1.9 milestone Feb 28, 2017
@ianlancetaylor
Copy link
Member

CC @randall77 @josharian

@josharian
Copy link
Contributor

Looking at tighten.go at 1.7.5, that line is:

uses := make([]int32, f.NumValues())

f isn't nil; we can see from the stack trace. And we couldn't have gotten this far with a nil Func anyway.

NumValues is here:

https://github.com/golang/go/blob/release-branch.go1.7/src/cmd/compile/internal/ssa/func.go#L52
https://github.com/golang/go/blob/release-branch.go1.7/src/cmd/compile/internal/ssa/id.go#L26

I don't see anything there that could lead to a nil pointer dereference. This smells like memory corruption.

I'm not sure there's much to do if you can't reproduce it any more, even sporadically. I'll leave this open in case Keith has ideas, though.

@randall77
Copy link
Contributor

I concur with Josh, I'm not seeing how this could happen.
I'm going to close for now, feel free to reopen if you see this again.

@golang golang locked and limited conversation to collaborators Feb 28, 2018
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

5 participants