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: panic: runtime error: invalid memory address or nil pointer dereference #54746

Closed
kralicky opened this issue Aug 29, 2022 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.

Comments

@kralicky
Copy link

kralicky commented Aug 29, 2022

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

$ go version
go version go1.19 linux/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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/joe/.cache/go-build"
GOENV="/home/joe/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/joe/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/joe/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/joe/sdk/go1.19"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/joe/sdk/go1.19/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/joe/tmp/go-ice/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-build1648616691=/tmp/go-build -gno-record-gcc-switches"

What did you do?

The following program will trigger the ICE:

https://go.dev/play/p/1MeZY9-tOtp

package main

type Interface interface {
	Method() Interface
}
type Struct struct{}

func (x *Struct) Method() Interface {
	return nil
}
func clone(m Interface) Interface {
	return nil
}
func Clone[T Interface](msg T) T {
	return clone(msg).(T)
}
func (in *Struct) Foo() *Struct {
	return Clone(in)
}
func main() {
}

What did you expect to see?

No error

What did you see instead?

<autogenerated>:1: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference

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 Aug 29, 2022
@cuonglm
Copy link
Member

cuonglm commented Aug 29, 2022

Seems duplicated of #54302

@cuonglm
Copy link
Member

cuonglm commented Aug 29, 2022

Confirm that 0c4db1e fixed this, so it's duplicated of #54302

@cuonglm cuonglm closed this as completed Aug 29, 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

3 participants