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/go: internal compiler error: assertion failed: on source consisting of {panic, declaration, label} #67661

Closed
jfrech opened this issue May 27, 2024 · 2 comments

Comments

@jfrech
Copy link

jfrech commented May 27, 2024

Go version

go version go1.22.1 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/jfrech/.cache/go-build'
GOENV='/home/jfrech/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jfrech/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/jfrech/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -ffile-prefix-map=/tmp/go-build2525126656=/tmp/go-build -gno-record-gcc-switches'

What did you do?

With the following the contents of /tmp/ice.go (the Go playground rejects it as it doesn't vet):

package main

func main() {
	panic(0)

	x := 0

l:
	for {
		goto l
	}

	_ = x
}

I attempted compilation.

What did you see happen?

Attempting to compile lead to an internal compiler error:

$ go build /tmp/ice.go 
# command-line-arguments
CLOSURE [/tmp/ice.go:13:6:var x int]
<unknown line number>: internal compiler error: assertion failed

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

Fiddling with the panic's placement, the existence of a label and the existence of a declaration which is referenced after the label, only this combination yielded an internal compiler error.

What did you expect to see?

I want to get an executable which immediately panics, not a confused compiler's goodbye.

@cuonglm
Copy link
Member

cuonglm commented May 27, 2024

This is duplicated of #65593

@cuonglm cuonglm closed this as completed May 27, 2024
@jfrech
Copy link
Author

jfrech commented May 27, 2024

I updated to go1.22.3 linux/amd64 which doesn't ice on the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants