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 #58349

Closed
dgavedissian opened this issue Feb 6, 2023 · 3 comments
Closed

cmd/compile: internal compiler error: Value live at entry #58349

dgavedissian opened this issue Feb 6, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@dgavedissian
Copy link

dgavedissian commented Feb 6, 2023

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

module ice

go 1.19

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.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Feb 6, 2023
@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 6, 2023
@dr2chase dr2chase self-assigned this Feb 6, 2023
@dr2chase
Copy link
Contributor

dr2chase commented Feb 6, 2023

This appears to be fixed with unified IR, e.g.:

go build .
# ice
./main.go:8:23: internal compiler error: 'main': Value live at entry. It shouldn't be. func main, node inner..dict0, value nil

versus

GOEXPERIMENT=unified go build .
# silence is golden

@cuonglm
Copy link
Member

cuonglm commented Feb 7, 2023

I think we can close this issue. Bug with old generic implementation and fixed with Unified IR won't be backport.

@mknyszek mknyszek added this to the Backlog milestone Feb 15, 2023
@mknyszek
Copy link
Contributor

In triage: since we're not going to backport this (by policy) and there is a workaround, closing this issue.

@mknyszek mknyszek closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
@golang golang locked and limited conversation to collaborators Feb 15, 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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants