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: ICE instantiating a generic type B in type A[T] struct{}; type B[T] A[[]T] with error #56626

Closed
twz123 opened this issue Nov 7, 2022 · 2 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge generics Issue is related to generics NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@twz123
Copy link

twz123 commented Nov 7, 2022

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

$ go version
go version go1.19.3 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="/home/user/.local/share/go/bin"
GOCACHE="/home/user/.cache/go/cache"
GOENV="/home/user/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/user/.cache/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/user/.local/share/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/nix/store/mpbwhnfs6ciqrnckyn33z2yljsgpg416-go-1.19.3/share/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/nix/store/mpbwhnfs6ciqrnckyn33z2yljsgpg416-go-1.19.3/share/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/user/boom/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-build3668342732=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I've put together the following program: https://go.dev/play/p/J8PRzNRJoUi

What did you expect to see?

As far as my Go knowledge goes, I think the above program is valid. I expected to see the program compile and run with no output. If I am wrong and the program is not okay, I would have expected a proper compiler error to be displayed that indicates the problem(s).

What did you see instead?

An internal compiler error. Running this on the Go Playground gives me:

# play.ground/foo
<autogenerated>:1: internal compiler error: missing pkg

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

Go build failed.

My observations

  • Using any other type than error in x := SlicedInner[error]{} on line 27 makes it compile. I tried other interfaces (including any), primitives, struct pointers, ...
  • Actually using the return value of CallSomeFuncOnInner (i.e. by uncommenting the fmt.Println) fixes it, too.
@mknyszek mknyszek changed the title Internal compiler error with newtypes over generic arrays when using the error type cmd/compile: ICE instantiating a generic type B in type A[T] struct{}; type B[T] A[[]T] with error Nov 7, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Nov 7, 2022
@mknyszek mknyszek added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. generics Issue is related to generics labels Nov 7, 2022
@mknyszek mknyszek added this to the Backlog milestone Nov 7, 2022
@mknyszek
Copy link
Contributor

mknyszek commented Nov 7, 2022

CC @golang/compiler

@cuonglm
Copy link
Member

cuonglm commented Nov 7, 2022

Duplicated of #55101

@cuonglm cuonglm closed this as completed Nov 7, 2022
@golang golang locked and limited conversation to collaborators Nov 7, 2023
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 generics Issue is related to generics 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

4 participants