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. #57702

Closed
SladeThe opened this issue Jan 9, 2023 · 2 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge

Comments

@SladeThe
Copy link

SladeThe commented Jan 9, 2023

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

$ go version
go version go1.19.4 windows/amd64

Does this issue reproduce with the latest release?

yes

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\SLADE\AppData\Local\go-build
set GOENV=C:\Users\SLADE\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\SLADE\.gopath\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\SLADE\.gopath
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=D:\Programs\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Programs\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.4
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\Projects\Go\issue\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\SLADE\AppData\Local\Temp\go-build583418767=/tmp/go-build -gno-record-gcc-switches

What did you do?

This single-package version works just fine.

But if I move all the code except main-func to a package, e.g. foo, the code stops working.

main.go
package main

import (
"issue/foo"
)

func main() {
println(foo.Chain(foo.Foo()))
}

foo/foo.go
package foo

type Func func() error

func Chain(funcs ...Func) error {
for _, f := range funcs {
if err := f(); err != nil {
return err
}
}

return nil

}

func Foo() Func {
return bar[string]{}.Validate
}

type bar[T any] struct{}

func (v bar[T]) Validate() error {
return nil
}

go.mod
module issue

go 1.19

What did you expect to see?

Is compiles successfully

What did you see instead?

.\main.go:8:27: internal compiler error: 'main': Value live at entry. It shouldn't be. func main, node foo..rcvr1, value nil

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 9, 2023
@SladeThe
Copy link
Author

SladeThe commented Jan 9, 2023

If I remove generic parameter from bar struct, the code also works fine, no matter the package.

@cuonglm
Copy link
Member

cuonglm commented Jan 9, 2023

Duplicated of #54911

@cuonglm cuonglm closed this as completed Jan 9, 2023
@golang golang locked and limited conversation to collaborators Jan 9, 2024
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

3 participants