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: 'init': Value live at entry #56778

Closed
tdakkota opened this issue Nov 17, 2022 · 6 comments
Closed

cmd/compile: internal compiler error: 'init': Value live at entry #56778

tdakkota opened this issue Nov 17, 2022 · 6 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge

Comments

@tdakkota
Copy link

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

$ go version
go version devel go1.20-fee0ab8b5e Thu Nov 17 03:47:35 2022 +0000 windows/amd64

Does this issue reproduce with the latest release?

No.

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

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\tdakkota\AppData\Local\go-build
set GOENV=C:\Users\tdakkota\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\tdakkota\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\tdakkota\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=G:\workspace\golang\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=G:\workspace\golang\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.20-fee0ab8b5e Thu Nov 17 03:47:35 2022 +0000
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=G:\workspace\golang\go\src\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config

What did you do?

We got this error on our tip pipeline: https://github.com/gotd/td/actions/runs/3486077630/jobs/5832192510

Compiler fails to build this line:
https://github.com/gotd/td/blob/7aaba815698a4c2a57cfd68eac22ab4d84c74ad5/internal/mtproto/write.go#L18
I've tried to minimize the reproducer, but have had no success.

What did you expect to see?

Successful go build run.

What did you see instead?

Stack trace:

internal\mtproto\write.go:18:26: internal compiler error: 'init': Value live at entry. It shouldn't be. func init, node bin.length, value nil

goroutine 70 [running]:
runtime/debug.Stack()
        G:/workspace/golang/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x70a28?, 0xc0?}, {0xc001716550, 0x46}, {0xc001976a40, 0x4, 0x4})
        G:/workspace/golang/go/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
        G:/workspace/golang/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0xc0017abe90?, {0x0?, 0x0?}, {0x19da3fb, 0x40}, {0xc00197cfc0, 0x3, 0xc000070b01?})
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:7831 +0x177
cmd/compile/internal/ssagen.(*state).Fatalf(0xc000e081d0?, {0x19da3fb?, 0xc000070ae8?}, {0xc00197cfc0?, 0x17062e7?, 0xc00037c8c0?})
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:936 +0x6f
cmd/compile/internal/ssagen.(*state).variable(0xc00191dc00, {0x1b163e8, 0xc0015e4160}, 0x20?)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:6528 +0x186
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc00191dc00, {0x1b163e8?, 0xc0015e4160?}, 0x1)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:2684 +0x1bc
cmd/compile/internal/ssagen.(*state).expr(...)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:2642
cmd/compile/internal/ssagen.(*state).stmt(0xc00191dc00, {0x1b14e58, 0xc00179e140?})
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:1675 +0x4a71
cmd/compile/internal/ssagen.(*state).stmtList(...)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:1421
cmd/compile/internal/ssagen.(*state).stmt(0xc00191dc00, {0x1b15080, 0xc00179a240?})
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:1441 +0x45e5
cmd/compile/internal/ssagen.(*state).stmtList(...)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:1421
cmd/compile/internal/ssagen.(*state).stmt(0xc00191dc00, {0x1b14e58, 0xc0016054f0?})
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:1436 +0x150
cmd/compile/internal/ssagen.(*state).stmtList(...)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:1421
cmd/compile/internal/ssagen.buildssa(0xc001311a40, 0x3)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/ssa.go:552 +0x1ee6
cmd/compile/internal/ssagen.Compile(0xc001311a40, 0x0?)
        G:/workspace/golang/go/src/cmd/compile/internal/ssagen/pgen.go:185 +0x4c
cmd/compile/internal/gc.compileFunctions.func5.1(0x0?)
        G:/workspace/golang/go/src/cmd/compile/internal/gc/compile.go:171 +0x3a
cmd/compile/internal/gc.compileFunctions.func3.1()
        G:/workspace/golang/go/src/cmd/compile/internal/gc/compile.go:153 +0x32
created by cmd/compile/internal/gc.compileFunctions.func3
        G:/workspace/golang/go/src/cmd/compile/internal/gc/compile.go:152 +0x245
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 17, 2022
@tdakkota
Copy link
Author

It seems this issue is related to b1678e5.

@mvdan
Copy link
Member

mvdan commented Nov 17, 2022

Encountered the same error when building a different package:

go build github.com/pierrec/lz4: # github.com/pierrec/lz4
go/pkg/mod/github.com/pierrec/lz4@v2.6.1+incompatible/lz4.go:57:16: internal compiler error: 'init': Value live at entry. It shouldn't be. func init, node size, value nil

goroutine 82 [running]:
runtime/debug.Stack()
	/home/mvdan/tip/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x10ca48?, 0xc0?}, {0xc000e76500, 0x46}, {0xc0011649c0, 0x4, 0x4})
	/home/mvdan/tip/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	/home/mvdan/tip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0xc0011682c0?, {0x0?, 0x0?}, {0xde6ae3, 0x40}, {0xc001161800, 0x3, 0xc00010cb01?})
	/home/mvdan/tip/src/cmd/compile/internal/ssagen/ssa.go:7831 +0x177
cmd/compile/internal/ssagen.(*state).Fatalf(0xdb4f26?, {0xde6ae3?, 0xc00010cb08?}, {0xc001161800?, 0xb15567?, 0xc00039a7e0?})
	/home/mvdan/tip/src/cmd/compile/internal/ssagen/ssa.go:936 +0x6f
cmd/compile/internal/ssagen.(*state).variable(0xc001162500, {0xf20ce8, 0xc000c8b290}, 0xf17a68?)
	/home/mvdan/tip/src/cmd/compile/internal/ssagen/ssa.go:6528 +0x186
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc001162500, {0xf20ce8?, 0xc000c8b290?}, 0x1)
	/home/mvdan/tip/src/cmd/compile/internal/ssagen/ssa.go:2684 +0x1bc

@mvdan
Copy link
Member

mvdan commented Nov 17, 2022

For posterity, that lz4.go:57 is https://github.com/pierrec/lz4/blob/v2.6.1/lz4.go#L57.

cc @rsc @golang/compiler

@mkumatag
Copy link

we also have seen while building one of the openshift binary

+ make GO_REQUIRED_MIN_VERSION:= WHAT=cmd/openshift-tests
go build -mod=vendor -trimpath -ldflags "-X github.com/openshift/origin/pkg/version.versionFromGit="v4.1.0-6003-g403f0a4" -X github.com/openshift/origin/pkg/version.commitFromGit="403f0a4fe2" -X github.com/openshift/origin/pkg/version.gitTreeState="clean" -X github.com/openshift/origin/pkg/version.buildDate="2022-11-17T04:07:12Z" " github.com/openshift/origin/cmd/openshift-tests
go build github.com/docker/docker/pkg/pools: # github.com/docker/docker/pkg/pools
github.com/docker/docker@v20.10.17+incompatible/pkg/pools/pools.go:26:49: internal compiler error: 'init': Value live at entry. It shouldn't be. func init, node size, value nil

goroutine 36 [running]:
runtime/debug.Stack()
	/root/go/src/runtime/debug/stack.go:24 +0x6c
cmd/compile/internal/base.FatalfAt({0x70e8e0?, 0xc0?}, {0xc00084c8c0, 0x46}, {0xc0008dc200, 0x4, 0x4})
	/root/go/src/cmd/compile/internal/base/print.go:227 +0x270
cmd/compile/internal/base.Fatalf(...)
	/root/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0x6d0eec?, {0x6b1f9c?, 0x0?}, {0x98dafd, 0x40}, {0xc0008c3b90, 0x3, 0xc00070e901?})
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:7831 +0x19c
cmd/compile/internal/ssagen.(*state).Fatalf(0x95be22?, {0x98dafd?, 0xc0008cc400?}, {0xc0008c3b90?, 0x25b1c?, 0xc00036e700?})
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:936 +0xb4
cmd/compile/internal/ssagen.(*state).variable(0xc000739400, {0xad2b88, 0xc000657080}, 0xacca58?)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:6528 +0x194
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc000739400, {0xad2b88?, 0xc000657080?}, 0x1)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:2684 +0x184
cmd/compile/internal/ssagen.(*state).expr(...)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:2642
cmd/compile/internal/ssagen.(*state).stmt(0xc000739400, {0xad15f8, 0xc0006885a0?})
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:1675 +0x4678
cmd/compile/internal/ssagen.(*state).stmtList(...)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:1421
cmd/compile/internal/ssagen.(*state).stmt(0xc000739400, {0xad1820, 0xc00068a280?})
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:1441 +0x41d8
cmd/compile/internal/ssagen.(*state).stmtList(...)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:1421
cmd/compile/internal/ssagen.(*state).stmt(0xc000739400, {0xad15f8, 0xc000660d70?})
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:1436 +0x144
cmd/compile/internal/ssagen.(*state).stmtList(...)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:1421
cmd/compile/internal/ssagen.buildssa(0xc0004c7180, 0x3)
	/root/go/src/cmd/compile/internal/ssagen/ssa.go:552 +0x1c84
cmd/compile/internal/ssagen.Compile(0xc0004c7180, 0x0?)
	/root/go/src/cmd/compile/internal/ssagen/pgen.go:185 +0x48
cmd/compile/internal/gc.compileFunctions.func5.1(0xc000001aa0?)
	/root/go/src/cmd/compile/internal/gc/compile.go:171 +0x4c
cmd/compile/internal/gc.compileFunctions.func3.1()
	/root/go/src/cmd/compile/internal/gc/compile.go:153 +0x44
created by cmd/compile/internal/gc.compileFunctions.func3
	/root/go/src/cmd/compile/internal/gc/compile.go:152 +0x1f4

make: *** [vendor/github.com/openshift/build-machinery-go/make/targets/golang/build.mk:16: build] Error 1

@cuonglm
Copy link
Member

cuonglm commented Nov 17, 2022

It seems to me that we can't do the optimization if the inlined body contains non-trivial closures.

@gopherbot
Copy link

Change https://go.dev/cl/451555 mentions this issue: cmd/compile: fix static init for inlined calls

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

5 participants