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: OCONVIFACE can't operate on an empty interface #48276

Closed
mmrath opened this issue Sep 9, 2021 · 3 comments
Closed
Assignees
Labels
Milestone

Comments

@mmrath
Copy link

@mmrath mmrath commented Sep 9, 2021

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

$ go version
go version devel go1.18-c84f3a4004 Thu Sep 9 04:47:41 2021 +0000 darwin/amd64

Does this issue reproduce with the latest release?

No. I am using a version built from today's master

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

go env Output
$ go env

O111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/myusername/Library/Caches/go-build"
GOENV="/Users/myusername/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/myusername/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/myusername/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/myusername/Projects/golang-src"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/myusername/Projects/golang-src/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.7"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/myusername/Projects/golang-src/src/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/y4/b5zhbtf93r90hfy7gn1c2sjm0000gn/T/go-build2360186774=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Compile and run the code below using go run

package main

import "fmt"

func main() {
	IsZero[interface{}]("")
}

func IsZero[T comparable](val T) bool {
	var zero T
	fmt.Printf("%v:%v", zero, val)
	return val != zero
}

What did you expect to see?

Compile and run successfully or give a valid error

What did you see instead?

# command-line-arguments
./main.go:11:13: internal compiler error: OCONVIFACE can't operate on an empty interface

goroutine 1 [running]:
runtime/debug.Stack()
	/Users/myusername/Projects/golang-src/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x401810, 0xc0}, {0x19103ae, 0x2e}, {0x0, 0x0, 0x0})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/walk.walkConvInterface(0xc000439180, 0xc00042ef20)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/convert.go:65 +0x155
cmd/compile/internal/walk.walkExpr1({0x1a68cd0, 0xc000439180}, 0xc000439180)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:211 +0x57f
cmd/compile/internal/walk.walkExpr({0x1a68cd0, 0xc000439180}, 0xc00042ef20)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:55 +0x428
cmd/compile/internal/walk.walkAssign(0xc00042ef20, {0x1a68370, 0xc000741c70})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/assign.go:72 +0x9dc
cmd/compile/internal/walk.walkExpr1({0x1a68370, 0xc000741c70}, 0xc000741c70)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:179 +0x43f
cmd/compile/internal/walk.walkExpr({0x1a68370, 0xc000741c70}, 0xc00042ef20)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:55 +0x428
cmd/compile/internal/walk.walkStmt({0x1a68370, 0xc000741c70})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/stmt.go:57 +0x5da
cmd/compile/internal/walk.walkStmtList({0xc00008f2d0, 0x1, 0x0})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/stmt.go:167 +0x5b
cmd/compile/internal/walk.walkStmt({0x1a685c8, 0xc000472f80})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/stmt.go:98 +0x1a5
cmd/compile/internal/walk.slicelit(0x0, 0xc000446080, {0x1a69d38, 0xc00007f6c0}, 0xc00042f740)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/complit.go:405 +0xc6d
cmd/compile/internal/walk.anylit({0x1a68b40, 0xc000446080}, {0x1a69d38, 0xc00007f6c0}, 0xc00042f380)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/complit.go:592 +0x4c5
cmd/compile/internal/walk.oaslit(0xc000741a40, 0xc00007f6c0)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/complit.go:635 +0x198
cmd/compile/internal/walk.walkAssign(0xc00042f740, {0x1a68370, 0xc000741a40})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/assign.go:57 +0x5eb
cmd/compile/internal/walk.walkExpr1({0x1a68370, 0xc000741a40}, 0xc000741a40)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:179 +0x43f
cmd/compile/internal/walk.walkExpr({0x1a68370, 0xc000741a40}, 0xc00042f740)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:55 +0x428
cmd/compile/internal/walk.appendWalkStmt(0xc00042f740, {0x1a68370, 0xc000741a40})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/walk.go:256 +0x65
cmd/compile/internal/walk.ascompatee(0x16, {0xc00073afc0, 0x400, 0x1a69d38}, {0xc00073af80, 0xc0004390e0, 0x239a500})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/assign.go:372 +0x6fc
cmd/compile/internal/walk.walkAssignList(0xc00042fa80, 0xc0000939e0)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/assign.go:146 +0x12f
cmd/compile/internal/walk.walkExpr1({0x1a681e0, 0xc0000939e0}, 0xc0000939e0)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:183 +0x325
cmd/compile/internal/walk.walkExpr({0x1a681e0, 0xc0000939e0}, 0xc00042fa80)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/expr.go:55 +0x428
cmd/compile/internal/walk.walkStmt({0x1a681e0, 0xc0000939e0})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/stmt.go:57 +0x5da
cmd/compile/internal/walk.walkStmtList({0xc000716400, 0x17, 0xc0000766e0})
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/stmt.go:167 +0x5b
cmd/compile/internal/walk.Walk(0xc0000766e0)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/walk/walk.go:43 +0xef
cmd/compile/internal/gc.prepareFunc(0xc0000766e0)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/gc/compile.go:92 +0x6d
cmd/compile/internal/gc.enqueueFunc(0xc0000766e0)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/gc/compile.go:66 +0x2fd
cmd/compile/internal/gc.Main(0x191ef50)
	/Users/myusername/Projects/golang-src/src/cmd/compile/internal/gc/main.go:303 +0xe94
main.main()
	/Users/myusername/Projects/golang-src/src/cmd/compile/main.go:55 +0xdd
@cuonglm cuonglm added this to the Go1.18 milestone Sep 9, 2021
@cuonglm
Copy link
Member

@cuonglm cuonglm commented Sep 9, 2021

Loading

@ALTree ALTree changed the title Internal compiler error cmd/compile: internal compiler error: OCONVIFACE can't operate on an empty interface Sep 9, 2021
@cuonglm
Copy link
Member

@cuonglm cuonglm commented Sep 9, 2021

Loading

@randall77 randall77 self-assigned this Sep 9, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Sep 9, 2021

Change https://golang.org/cl/348736 mentions this issue: cmd/compile: stenciled conversions might be NOPs

Loading

@gopherbot gopherbot closed this in 19457a5 Sep 9, 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