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

Closed
siliconbrain opened this issue Jul 24, 2022 · 3 comments
Closed

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

siliconbrain opened this issue Jul 24, 2022 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.

Comments

@siliconbrain
Copy link

siliconbrain commented Jul 24, 2022

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

$ go version
go version go1.18.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes, but not with 1.18.3.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="[redacted]/Library/Caches/go-build"
GOENV="[redacted]/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="[redacted]/go/pkg/mod"
GONOPROXY="[redacted]"
GONOSUMDB="[redacted]"
GOOS="darwin"
GOPATH="[redacted]/go"
GOPRIVATE="[redacted]"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.18.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18.4/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="[redacted]/bug-test/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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cb/41fdz4g90xj4sym9lggjy2hc0000gn/T/go-build2109143364=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

The most minimal code snippet I could come up with that still produces the error is this:

package main

func main() {
	var v GI[any]
	F(v)
}

func F[T any](a GI[T]) {
	_, _ = a.(any) // the type assertion to a non-generic interface seems to cause the issue
}

type GI[T any] interface{}

It should reproduce the error if you try to execute it via go run.

What did you expect to see?

There should be no output but it should compile fine.

What did you see instead?

./main.go:5:3: internal compiler error: assertion failed

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

I tried to debug the problem on the original code base that I encountered the error with, but could only get as far as this line. (I only include this info in hope of making your job easier, but don't be misled by it, I'm not really familiar with the compiler internals.)

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 24, 2022
@ianlancetaylor
Copy link
Contributor

ianlancetaylor commented Jul 24, 2022

May be a dup of #53762.

@siliconbrain
Copy link
Author

siliconbrain commented Jul 25, 2022

Yes, seems like it is. Sorry, I only checked the open issues.

@cherrymui
Copy link
Member

cherrymui commented Jul 25, 2022

Thanks. Closing as a dup.

@cherrymui cherrymui closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2022
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

4 participants