What version of Go are you using (go version)?
$ go version
go version go1.19.5 linux/amd64
Does this issue reproduce with the latest release?
It does not occur on the latest major version (1.20.0), but it does occur on the latest minor versions of the last two major versions (1.19.5 and 1.18.10).
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/app/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1952771045=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I've reduced my code to this repro case. In summary, I have a function in main, that calls a function in another package, which then calls a generic function which returns a function object instanced to the passed type.
To reproduce, create 3 files:
go.mod
main.go
package main
import (
"ice/inner"
)
func main() {
inner.CallFuncWithInt()
}
inner/inner.go
package inner
func testFunction[T any]() {
}
func MakeFunc[T any]() func() {
return testFunction[T]
}
func CallFuncWithInt() {
_ = MakeFunc[int]()
}
It's important that the first function in the call stack crosses a package boundary, moving CallFuncWithInt into main instead results in no internal compiler error (hence why I can't provide a go.dev/play link).
What did you expect to see?
A successful compilation.
What did you see instead?
# ice
./main.go:8:20: internal compiler error: 'main': Value live at entry. It shouldn't be. func main, node test..dict0, value nil
Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
I've reproduced this error on 1.19.5 and 1.18.10, but it does not happen on 1.20.0.
All of these tests were done by mounting the code in a docker container:
docker run --platform linux/amd64 -it -w /app -v $PWD:/app golang:1.19.5 bash
followed by go build, go env etc.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
It does not occur on the latest major version (1.20.0), but it does occur on the latest minor versions of the last two major versions (1.19.5 and 1.18.10).
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
I've reduced my code to this repro case. In summary, I have a function in main, that calls a function in another package, which then calls a generic function which returns a function object instanced to the passed type.
To reproduce, create 3 files:
go.modmain.goinner/inner.goIt's important that the first function in the call stack crosses a package boundary, moving
CallFuncWithIntintomaininstead results in no internal compiler error (hence why I can't provide a go.dev/play link).What did you expect to see?
A successful compilation.
What did you see instead?
I've reproduced this error on 1.19.5 and 1.18.10, but it does not happen on 1.20.0.
All of these tests were done by mounting the code in a docker container:
docker run --platform linux/amd64 -it -w /app -v $PWD:/app golang:1.19.5 bashfollowed by
go build,go envetc.