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: Unexpected op with CALL during stenciling: CALLMETH #48042

Closed
nzlov opened this issue Aug 29, 2021 · 2 comments
Labels
Milestone

Comments

@nzlov
Copy link

@nzlov nzlov commented Aug 29, 2021

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

$ go version
go version devel go1.18-044550ab0e Sat Aug 28 06:22:11 2021 +0000 darwin/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="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nzlov/Library/Caches/go-build"
GOENV="/Users/nzlov/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nzlov/workspace/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nzlov/workspace/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/Users/nzlov/program/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/nzlov/program/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="devel go1.18-044550ab0e Sat Aug 28 06:22:11 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/nzlov/workspace/vgo/dataloader/go.mod"
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/71/4t6lk06x5y77f2wyln9vqnlw0000gn/T/go-build2097222530=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

run dataloader example

What did you expect to see?

run

What did you see instead?

panic line:

func (l *Loader[T]) Load(key string) (*T, error) {
	return l.LoadThunk(key)()
}
command-line-arguments
# command-line-arguments
/Users/nzlov/workspace/vgo/dataloader/loader.go:80:25: internal compiler error: Unexpected op with CALL during stenciling: CALLMETH

goroutine 1 [running]:
runtime/debug.Stack()
	/Users/nzlov/program/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x190ed19, 0x0}, {0xc0003af800, 0x33}, {0x0, 0x0, 0x0})
	/Users/nzlov/program/go/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/noder.(*subster).node.func1({0x1a657d8, 0xc0003b7710})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:1064 +0x10da
cmd/compile/internal/ir.editNodes({0xc000489f30, 0x1, 0x18cfa20}, 0xc0004ad7e8)
	/Users/nzlov/program/go/src/cmd/compile/internal/ir/node_gen.go:1521 +0x74
cmd/compile/internal/ir.(*AssignListStmt).editChildren(0xc0004d2ea0, 0x1a65260)
	/Users/nzlov/program/go/src/cmd/compile/internal/ir/node_gen.go:108 +0x6e
cmd/compile/internal/ir.EditChildren(...)
	/Users/nzlov/program/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/noder.(*subster).node.func1({0x1a65260, 0xc0004d2d20})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:903 +0x423
cmd/compile/internal/noder.(*subster).node(0xc0003c5a80, {0x1a65260, 0xc0004d2d20})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:1208 +0xa5
cmd/compile/internal/noder.(*subster).list(0xc000489f20, {0xc0003c5a00, 0x6, 0xc000421db0})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:1328 +0x8e
cmd/compile/internal/noder.(*irgen).genericSubst(0xc000124500, 0xc000806640, 0xc000095380, {0xc000484000, 0x1, 0x1}, 0x1, 0xc000798800)
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:722 +0xcc6
cmd/compile/internal/noder.(*irgen).getInstantiation(0xc000124500, 0xc000095380, {0xc00000f320, 0x1, 0x1}, 0x30)
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:608 +0x33d
cmd/compile/internal/noder.(*irgen).instantiateMethods(0xc000124500)
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:511 +0x248
cmd/compile/internal/noder.(*irgen).stencil(0xc000124500)
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/stencil.go:50 +0x9b
cmd/compile/internal/noder.(*irgen).generate(0xc000124500, {0xc000092960, 0x2, 0x0})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/irgen.go:294 +0x2d8
cmd/compile/internal/noder.check2({0xc000092960, 0x2, 0x2})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/irgen.go:92 +0x177
cmd/compile/internal/noder.LoadPackage({0xc0000a6100, 0x2, 0x0})
	/Users/nzlov/program/go/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0x191e1f0)
	/Users/nzlov/program/go/src/cmd/compile/internal/gc/main.go:190 +0xaf3
main.main()
	/Users/nzlov/program/go/src/cmd/compile/main.go:55 +0xdd

fix

run ok when with GOEXPERIMENT=unified

@cuonglm
Copy link
Member

@cuonglm cuonglm commented Aug 29, 2021

Small reproducer:

package p

type S[T any] struct {}

func (l *S[T]) M1() ([]*T, []error) {
	return nil, nil
}

func (l *S[T]) M2() (*T, error) {
	return l.M3()()
}

func (l *S[T]) M3() func() (*T, error) {
	return func() (*T, error) {
		return nil, nil
	}
}

var _, _ = (&S[int]{}).M1()

cc @danscales @randall77

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 29, 2021

Change https://golang.org/cl/345949 mentions this issue: cmd/compile: fix delay transformation in *subster.node()

Loading

@seankhliao seankhliao changed the title internal compiler error: Unexpected op with CALL during stenciling: CALLMETH cmd/compile: internal compiler error: Unexpected op with CALL during stenciling: CALLMETH Aug 29, 2021
@cherrymui cherrymui added this to the Go1.18 milestone Aug 31, 2021
@gopherbot gopherbot closed this in ecfff58 Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants