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: assertion failed #66132

Closed
karelbilek opened this issue Mar 6, 2024 · 2 comments
Closed

cmd/compile: internal compiler error: assertion failed #66132

karelbilek opened this issue Mar 6, 2024 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.

Comments

@karelbilek
Copy link

Go version

go version go1.22.0 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/karelbilek/Library/Caches/go-build'
GOENV='/Users/karelbilek/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/karelbilek/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/karelbilek/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/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/karelbilek/pstopdfa-gs-wazero/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 -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/qk/9bbz1shn0dj8vdkg4lf76clh0000gn/T/go-build3538269826=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Small repro:

package main

func main() {
}

func SomeFunc() (map[string]int, error) {
	panic("foo")

	arr := []string{}

	mapp := map[string]int{}

LABEL:
	for _, f := range arr {
		continue LABEL
		mapp[f] = 2
	}

	return mapp, nil
}

Replicable here.

https://go.dev/play/p/fLjUPRVQ90v

Note that all is needed:

  1. the panic("foo")
  2. the labeled for loop (removing the label removes the issue)
  3. the mapp variable

What did you see happen?

CLOSURE [prog.go:14:20:var arr []string ./prog.go:16:3:var mapp map[string]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

See playground.

What did you expect to see?

This should build sucessfully.

The code itself is dumb and is just the smallest repro I can do.

go1.21 works on the same codebase (go vet warns, but that's expected).

@karelbilek karelbilek changed the title internal compiler error: assertion failed cmd/compile: internal compiler error: assertion failed Mar 6, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Mar 6, 2024
@thanm
Copy link
Contributor

thanm commented Mar 6, 2024

Thanks for the report.

This looks like a duplicate of #65593, which is now fixed on tip.

@thanm
Copy link
Contributor

thanm commented Mar 6, 2024

Dup of #65593

@thanm thanm closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

3 participants