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: Value live at entry. It shouldn't be. #17596

Closed
LK4D4 opened this issue Oct 26, 2016 · 10 comments
Closed
Milestone

Comments

@LK4D4
Copy link
Contributor

LK4D4 commented Oct 26, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version devel +6e02750 Wed Oct 26 02:24:45 2016 +0000 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/home/moroz/go"
GOTOOLDIR="/home/moroz/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build703362554=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

go get github.com/nsqio/nsq/apps/nsqd

What did you expect to see?

Compiled nsqd

What did you see instead?

# github.com/nsqio/go-nsq
src/github.com/nsqio/go-nsq/config.go:517: internal compiler error: Value live at entry. It shouldn't be. func coerce, node autotmp_499, value v1019

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
        /home/moroz/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0xa47006, 0x40, 0xc4217b07b0, 0x3, 0x3)
        /home/moroz/go/src/cmd/compile/internal/gc/subr.go:165 +0x226
cmd/compile/internal/gc.(*ssaExport).Fatalf(0xd0f2f5, 0x33e, 0xa47006, 0x40, 0xc4217b07b0, 0x3, 0x3)
        /home/moroz/go/src/cmd/compile/internal/gc/ssa.go:4615 +0x5d
cmd/compile/internal/ssa.(*Config).Fatalf(0xc421454000, 0xc40000033e, 0xa47006, 0x40, 0xc4217b07b0, 0x3, 0x3)
        /home/moroz/go/src/cmd/compile/internal/ssa/config.go:319 +0x6e
cmd/compile/internal/gc.(*state).Fatalf(0xc42140ab40, 0xa47006, 0x40, 0xc4217b07b0, 0x3, 0x3)
        /home/moroz/go/src/cmd/compile/internal/gc/ssa.go:282 +0x83
cmd/compile/internal/gc.(*simplePhiState).insertPhis(0xc42124d528)
        /home/moroz/go/src/cmd/compile/internal/gc/phi.go:458 +0x284
cmd/compile/internal/gc.(*state).insertPhis(0xc42140ab40)
        /home/moroz/go/src/cmd/compile/internal/gc/phi.go:33 +0x172
cmd/compile/internal/gc.buildssa(0xc420e71830, 0x0)
        /home/moroz/go/src/cmd/compile/internal/gc/ssa.go:170 +0x901
cmd/compile/internal/gc.compile(0xc420e71830)
        /home/moroz/go/src/cmd/compile/internal/gc/pgen.go:359 +0x204
cmd/compile/internal/gc.funccompile(0xc420e71830)
        /home/moroz/go/src/cmd/compile/internal/gc/dcl.go:1282 +0xdc
cmd/compile/internal/gc.Main()
        /home/moroz/go/src/cmd/compile/internal/gc/main.go:469 +0x1eff
main.main()
        /home/moroz/go/src/cmd/compile/main.go:47 +0x15d
@bradfitz bradfitz changed the title internal compiler error: Value live at entry. It shouldn't be. cmd/compile: internal compiler error: Value live at entry. It shouldn't be. Oct 26, 2016
@bradfitz bradfitz added this to the Go1.8 milestone Oct 26, 2016
@dr2chase
Copy link
Contributor

dr2chase commented Oct 26, 2016

(Even) smaller reproducer:

package foo

import "fmt"

//go:noinline
func coerceStringer(v interface{}) (fmt.Stringer, error) {
    return &StringyThing{}, nil
}

type StringyThing struct {
}

func (*StringyThing) String() string {
    return "stringything"
}

func coerce(v interface{}, typ string) (interface{}, error) {
    var err error

    if typ == "Stringer" {
        v, err = coerceStringer(v)
    } else {
        v = nil
    }

    return v, err
}

@dr2chase
Copy link
Contributor

Shorter reproducer above.
The badness seems to be entirely within walk.go, it constructs AST that looks like this (first mention of autotmp_2:

.   IF-body
.   .   BLOCK-init
.   .   .   AS l(21)
.   .   .   .   NAME-foo.autotmp_3 u(1) a(true) l(21) x(0) class(PAUTO) esc(N) tc(1) used(true) fmt.Stringer
.   .   .   .   NAME-foo.autotmp_2 u(1) a(true) l(21) x(0) class(PAUTO) esc(N) tc(1) used(true) fmt.Stringer

@dr2chase
Copy link
Contributor

Problematic OAS node is constructed at this stack trace (common to both examples, involves OAS2FUNC going wrong in some special way):

#0  cmd/compile/internal/gc.nod (op=20 '\024', nleft=0xc4203d9560, nright=0xc4203d93b0, ~r3=0xc42035a2e0)
    at .../cmd/compile/internal/gc/subr.go:362
#1  0x0000000000547c4d in cmd/compile/internal/gc.walkexpr (n#150=0xc4203d94d0, init=0xc42036b310, ~r2=0x631013 <string.*+38683>)
    at .../cmd/compile/internal/gc/walk.go:1090
#2  0x0000000000553835 in cmd/compile/internal/gc.convas (n=0xc4203d9440, init=0xc42036b310, ~r2=0xc4203d93b0)
    at .../cmd/compile/internal/gc/walk.go:2340
#3  0x00000000005501a7 in cmd/compile/internal/gc.ascompatet (op=22 '\026', nl=..., nr=0xc420358360, fp=0, init=0xc42036b310, 
    ~r5= []*cmd/compile/internal/gc.Node) at .../cmd/compile/internal/gc/walk.go:1874
#4  0x000000000054371b in cmd/compile/internal/gc.walkexpr (n#150=0xc42035bcb0, init=0xc42036b310, ~r2=0x0)
    at .../cmd/compile/internal/gc/walk.go:823
#5  0x000000000054182a in cmd/compile/internal/gc.walkstmt (n#20=0xc42035bcb0, ~r1=0xc4203d8750)
    at .../cmd/compile/internal/gc/walk.go:192
#6  0x00000000005407c4 in cmd/compile/internal/gc.walkstmtlist (s= []*cmd/compile/internal/gc.Node = {...})
    at .../cmd/compile/internal/gc/walk.go:80

@bradfitz
Copy link
Contributor

We just got this on an http2 trybot run:

https://storage.googleapis.com/go-build-log/1e6b12a2/linux-386_7f5f0646.log

linux-386 at 1e6b12a201e5fa7009510bb036367dfb0f5a6320 building net at 495e63a0f6f01eab21c56de7838a0139012a985e

# golang.org/x/net/http2
../../gopath/src/golang.org/x/net/http2/frame_test.go:859: internal compiler error: Value live at entry. It shouldn't be. func TestMetaFrameHeader, node autotmp_4023, value v1519

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
    /tmp/workdir/go/src/runtime/debug/stack.go:24 +0x64
cmd/compile/internal/gc.Fatalf(0x859805b, 0x40, 0x196125a0, 0x3, 0x3)
    /tmp/workdir/go/src/cmd/compile/internal/gc/subr.go:165 +0x1d2
cmd/compile/internal/gc.(*ssaExport).Fatalf(0x87f4115, 0x26d0, 0x859805b, 0x40, 0x196125a0, 0x3, 0x3)
    /tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:4615 +0x4b
cmd/compile/internal/ssa.(*Config).Fatalf(0x1a8da000, 0x26d0, 0x859805b, 0x40, 0x196125a0, 0x3, 0x3)
    /tmp/workdir/go/src/cmd/compile/internal/ssa/config.go:319 +0x57
cmd/compile/internal/gc.(*state).Fatalf(0x1af29500, 0x859805b, 0x40, 0x196125a0, 0x3, 0x3)
    /tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:282 +0x60
cmd/compile/internal/gc.(*simplePhiState).insertPhis(0x1ab49a78)
    /tmp/workdir/go/src/cmd/compile/internal/gc/phi.go:458 +0x20e
cmd/compile/internal/gc.(*state).insertPhis(0x1af29500)
    /tmp/workdir/go/src/cmd/compile/internal/gc/phi.go:33 +0x109
cmd/compile/internal/gc.buildssa(0x19a91e00, 0x0)
    /tmp/workdir/go/src/cmd/compile/internal/gc/ssa.go:170 +0x782
cmd/compile/internal/gc.compile(0x19a91e00)
    /tmp/workdir/go/src/cmd/compile/internal/gc/pgen.go:357 +0x1b9
cmd/compile/internal/gc.funccompile(0x19a91e00)
    /tmp/workdir/go/src/cmd/compile/internal/gc/dcl.go:1282 +0xd4
cmd/compile/internal/gc.Main()
    /tmp/workdir/go/src/cmd/compile/internal/gc/main.go:469 +0x1aa9
main.main()
    /tmp/workdir/go/src/cmd/compile/main.go:47 +0x137

ok      golang.org/x/net/bpf    0.465s
ok      golang.org/x/net/context    0.110s
ok      golang.org/x/net/context/ctxhttp    0.110s
?       golang.org/x/net/dict   [no test files]
ok      golang.org/x/net/html   0.089s
ok      golang.org/x/net/html/atom  0.005s
ok      golang.org/x/net/html/charset   0.006s
FAIL    golang.org/x/net/http2 [build failed]

/cc @tombergan

@bradfitz
Copy link
Contributor

Actually trybot failure is unrelated; the net repo is all red on https://build.golang.org/ at tip already.

@josharian
Copy link
Contributor

Bisecting.

@josharian
Copy link
Contributor

Bisect says c78d072, which is re-enabling the convI2E optimization. Shall we revert the revert of the revert, @randall77?

@gopherbot
Copy link

CL https://golang.org/cl/32226 mentions this issue.

@dr2chase
Copy link
Contributor

It's related to fncall, line 1834, which (incorrectly with I2E optimization) asserts that an I to E conversion requires a function call. Making the obvious fix clears the compile-time error and also passes all.bash, but generates bad code.

@gopherbot
Copy link

CL https://golang.org/cl/32184 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 27, 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

6 participants