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: shape types have no methods PTR-*cache.AnyCache[interface {}] #50109

Closed
sylr opened this issue Dec 11, 2021 · 6 comments
Closed
Milestone

Comments

@sylr
Copy link

sylr commented Dec 11, 2021

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

$ go version devel go1.18-766f89b Fri Dec 10 19:26:50 2021 +0000 darwin/arm64

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="arm64"
GOBIN=""
GOCACHE="/Users/sylvain/Library/Caches/go-build"
GOENV="/Users/sylvain/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/sylvain/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sylvain/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/sylvain/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/sylvain/sdk/gotip/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="devel go1.18-766f89b Fri Dec 10 19:26:50 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/sylvain/git/go-cache/go.mod"
GOWORK="/Users/sylvain/go.work"
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 arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hq/ttl6jyh539q55fz6282w0jyc0000gn/T/go-build2711542412=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Upgraded gotip today and ran gotip test ./... on a project that used to work 3 weeks ago.

# sylr.dev/cache/v3_test [sylr.dev/cache/v3.test]
./cache_mutex.go:460:9: internal compiler error: shape types have no methods PTR-*cache.AnyCache[interface {}]

goroutine 1 [running]:
runtime/debug.Stack()
	/Users/sylvain/sdk/gotip/src/runtime/debug/stack.go:24 +0x68
cmd/compile/internal/base.FatalfAt({0x43cef8?, 0x140?}, {0x100d6cf5b, 0x1f}, {0x1400043cee8, 0x1, 0x1})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/base/print.go:227 +0x20c
cmd/compile/internal/base.Fatalf(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/reflectdata.MarkTypeUsedInInterface(0x1400074f880, 0x140005eb480)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/reflectdata/reflect.go:1989 +0x70
cmd/compile/internal/noder.markTypeUsed(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:1505
cmd/compile/internal/noder.(*genInst).getDictionarySym(0x10148db00, 0x1400058c820, {0x140000acb70, 0x1, 0x1}, 0x0)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:1555 +0x3dc
cmd/compile/internal/noder.(*genInst).getDictionaryValue(0x1400043d218?, {0x7a2014?, 0x1?}, 0x0?, {0x140000acb70?, 0x140007381e0?, 0x1400060b340?}, 0x58?)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:1740 +0x40
cmd/compile/internal/noder.(*genInst).getDictOrSubdict(0x10148db00?, 0x1400058c820?, {0x100f99378?, 0x1400058e3f0?}, 0x12838bfff?, {0x140000acb70, 0x1, 0x1}, 0x18?)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:626 +0xb4
cmd/compile/internal/noder.(*genInst).scanForGenCalls.func1({0x100f99378, 0x1400058e3f0?})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:177 +0x2d8
cmd/compile/internal/ir.Visit.func1({0x100f99378, 0x1400058e3f0})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:105 +0x38
cmd/compile/internal/ir.(*AssignStmt).doChildren(0x1400059d040, 0x140005ee000)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:152 +0x84
cmd/compile/internal/ir.DoChildren(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:94
cmd/compile/internal/ir.Visit.func1({0x100f98f90, 0x1400059d040})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:106 +0x5c
cmd/compile/internal/ir.doNodes(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/node_gen.go:1512
cmd/compile/internal/ir.(*Func).doChildren(0x100f99cd8?, 0x140005ee000?)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/func.go:152 +0x80
cmd/compile/internal/ir.DoChildren(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:94
cmd/compile/internal/ir.Visit.func1({0x100f99cd8, 0x140003c2f20})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:106 +0x5c
cmd/compile/internal/ir.Visit({0x100f99cd8, 0x140003c2f20}, 0x140005b8680)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/ir/visit.go:108 +0xbc
cmd/compile/internal/noder.(*genInst).scanForGenCalls(0x10148db00, {0x100f99cd8, 0x140003c2f20})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:158 +0x1d8
cmd/compile/internal/noder.(*genInst).buildInstantiations(0x10148db00, 0x1)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:65 +0x390
cmd/compile/internal/noder.BuildInstantiations(...)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/stencil.go:47
cmd/compile/internal/noder.(*irgen).generate(0x140000fe240, {0x140000ac430, 0x1, 0x8?})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/irgen.go:320 +0x3c4
cmd/compile/internal/noder.check2({0x140000ac430, 0x1, 0x1})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/irgen.go:92 +0x130
cmd/compile/internal/noder.LoadPackage({0x140000b6110, 0x1, 0x0?})
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/noder/noder.go:90 +0x2f0
cmd/compile/internal/gc.Main(0x100f91860)
	/Users/sylvain/sdk/gotip/src/cmd/compile/internal/gc/main.go:191 +0xbe0
main.main()
	/Users/sylvain/sdk/gotip/src/cmd/compile/main.go:55 +0xf8

FAIL	sylr.dev/cache/v3 [build failed]
FAIL

Code can be found at https://github.com/sylr/go-cache

@danscales
Copy link
Contributor

Thanks for the report!

I'm looking at this issue. I bisected it to some recent changes related to 'any' semantics/error messages.

@danscales danscales self-assigned this Dec 12, 2021
@danscales danscales added this to the Go1.18 milestone Dec 12, 2021
@danscales danscales changed the title internal compiler error: shape types have no methods PTR-*cache.AnyCache[interface {}] cmd/compile: shape types have no methods PTR-*cache.AnyCache[interface {}] Dec 12, 2021
@gopherbot
Copy link

Change https://golang.org/cl/371154 mentions this issue: cmd/compile: fix identity case relating to 'any' ann shapes

@rogpeppe
Copy link
Contributor

rogpeppe commented Dec 13, 2021

The test in the CL that fixed this is rather involved. This seems to be a rather smaller one: https://gotipplay.golang.org/p/bp3VMZA_9CU

package main

func main() {
	F[any]()
}

func F[T any]() I[T] {
	return (*S1[T])(nil)
}

type I[T any] interface{}

type S1[T any] struct {
	*S2[T]
}

type S2[T any] struct {
	S3 *S3[T]
}

type S3[T any] struct {
	x int
}

@danscales

@danscales
Copy link
Contributor

Thanks for minimizing, @rogpeppe ! I'll add that as a separate test for the issue. I tried to minimize somewhat more, but also wanted to get the change reviewed and some version of a test in quickly, since beta is coming up.

@sylr
Copy link
Author

sylr commented Dec 13, 2021

Thanks @danscales!

@gopherbot
Copy link

Change https://golang.org/cl/371515 mentions this issue: test: add simpler test for issue 50109

gopherbot pushed a commit that referenced this issue Dec 15, 2021
Thanks to the simpler test case for issue 50109. I'm keeping the old
test case in place, since it's not too complex, and may be useful for
testing other things as well.

Updates #50109

Change-Id: I80cdbd1da473d0cc4dcbd68e45bab7ddb6f9263e
Reviewed-on: https://go-review.googlesource.com/c/go/+/371515
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: roger peppe <rogpeppe@gmail.com>
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants