What version of Go are you using (go version)?
$ go version
go version go1.20 linux/amd64
Does this issue reproduce with the latest release?
Reproduces with Go 1.20, but not with 1.19.4
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/codespace/.cache/go-build"
GOENV="/home/codespace/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/codespace/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/codespace/go:/home/codespace/src/server/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.20"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/workspaces/goissue/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1991160894=/tmp/go-build -gno-record-gcc-switches"
What did you do?
main.go:
package main
func main() {
_ = Tree[int]{}
}
type Tree[T comparable] struct {
parent map[T]T
}
func (g *Tree[T]) RemoveParent(node T) {
defer delete(g.parent, node)
// To fix, remove "defer" from the above line, like below.
// delete(g.parent, node)
}
What did you expect to see?
What did you see instead?
$ go build
# goissue
./main.go:12:2: internal compiler error: '(*Tree[go.shape.int]).RemoveParent.func1': value .dict (nil) incorrectly live at entry
Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
$ GOEXPERIMENT=nounified go build
#57778 shows the same error
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Reproduces with Go 1.20, but not with 1.19.4
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
main.go:What did you expect to see?
What did you see instead?
#57778 shows the same error