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: shape types have no methods go.shape.int_0 #50642

Closed
mishapoiuytrewq opened this issue Jan 16, 2022 · 3 comments
Labels
NeedsInvestigation release-blocker
Milestone

Comments

@mishapoiuytrewq
Copy link

@mishapoiuytrewq mishapoiuytrewq commented Jan 16, 2022

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

$ go version
go version go1.18beta1 linux/amd64

Does this issue reproduce with the latest release?

Yes.
https://go.dev/play/p/L0FDK8tRORW?v=gotip
or
https://gotipplay.golang.org/p/L0FDK8tRORW

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/misha/.cache/go-build"
GOENV="/home/misha/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/misha/.asdf/installs/golang/1.18beta1/packages/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/misha/.asdf/installs/golang/1.18beta1/packages"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/misha/.asdf/installs/golang/1.18beta1/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/misha/.asdf/installs/golang/1.18beta1/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18beta1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/misha/GolandProjects/awesomeProject/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1277497051=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://go.dev/play/p/L0FDK8tRORW?v=gotip
or
https://gotipplay.golang.org/p/L0FDK8tRORW

What did you expect to see?

panic: interface conversion: interface {} is nil, not <-chan int

What did you see instead?

./main.go:17:14: internal compiler error: shape types have no methods go.shape.int_0

@mishapoiuytrewq mishapoiuytrewq changed the title affected/package: 1.18beta1; go1.18-3b5eec9370; cmd/compile: when trying to cast any in chan, panic occurs Jan 16, 2022
@mishapoiuytrewq mishapoiuytrewq changed the title cmd/compile: when trying to cast any in chan, panic occurs cmd/compile: internal compiler error: shape types have no methods go.shape.int_0 Jan 16, 2022
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 16, 2022

CC @randall77 @danscales

@ianlancetaylor ianlancetaylor added NeedsInvestigation release-blocker labels Jan 16, 2022
@ianlancetaylor ianlancetaylor added this to the Go1.18 milestone Jan 16, 2022
@danscales
Copy link
Contributor

@danscales danscales commented Jan 17, 2022

The CONVIFACE that is needed to convert "<- ch.(<-chan T)" (which has type T) to any (empty interface, the type of temp) is currently being created only during the walk phase, but we need it to be created during the transforms after instantiation, so it is available during the dictionary pass. I can fix the transform pass to do that, but it may be a bit tricky, because of the tight connection between the AS2RECV and RECV operations. I looks like we have a similar problem with AS2MAPR and AS2DOTTYPE (when the first rhs is implicitly being converted to an interface from a type-param-derived type).

@danscales danscales self-assigned this Jan 17, 2022
@gopherbot
Copy link

@gopherbot gopherbot commented Jan 18, 2022

Change https://golang.org/cl/379054 mentions this issue: cmd/compile: add early a CONVIFACE normally created in the order phase

Dirk007 added a commit to Dirk007/yahooStocks2Mqtt that referenced this issue Apr 12, 2022
jproberts pushed a commit to jproberts/go that referenced this issue Jun 21, 2022
Most CONVIFACEs are created in the transform phase (or old typechecker,
in -G=0 mode). But if the main result of a multi-value assignment (map,
channel, or dot-type) must be converted to an interface during the
assignment, that CONVIFACE is not created until (*orderState).as2ok in
the order phase (because the AS2* ops and their sub-ops are so tightly
intertwined). But we need to create the CONVIFACE during the
stenciling/transform phase to enable dictionary lookups. So, in
transformAssign(), if we are doing a special multi-value assignment
involving a type-param-derived type, assign the results first to temps,
so that we can manifest the CONVIFACE during the transform in assigning
the first temp to lhs[0].

Added a test for both AS2RECV (channel receives) and AS2MAPR (maps). I
don't think we can have a type assertion on a type-param-derived type.

Fixes golang#50642

Change-Id: I4d079fc46c93d8494d7db4ea8234d91522edb02a
Reviewed-on: https://go-review.googlesource.com/c/go/+/379054
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants