go: cmd/compile: internal compiler error: panic: interface conversion: ir.Node is *ir.BasicLit, not *ir.ConstExpr
What version of Go are you using (go version
)?
$ go version go version go1.20 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/r/Library/Caches/go-build" GOENV="/Users/r/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/r/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/r/go" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/Users/r/sdk/go1.20" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/Users/r/sdk/go1.20/pkg/tool/darwin_arm64" GOVCS="" GOVERSION="go1.20" GCCGO="gccgo" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/Users/r/workspace/testcode/testinline/bug2.1/go.mod" GOWORK="" CGO_CFLAGS="-O2 -g" CGO_CPPFLAGS="" CGO_CXXFLAGS="-O2 -g" CGO_FFLAGS="-O2 -g" CGO_LDFLAGS="-O2 -g" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/j_/rq9ph2cd3h50w468sgv34lwh0000gn/T/go-build2923148267=/tmp/go-build -gno-record-gcc-switches -fno-common" GOROOT/bin/go version: go version go1.20 darwin/arm64 GOROOT/bin/go tool compile -V: compile version go1.20 uname -v: Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 ProductName: macOS ProductVersion: 13.1 BuildVersion: 22C65 lldb --version: lldb-1400.0.38.17 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
What did you do?
go.mod
:
module foo
go 1.20
pkg/a.go
:
package pkg
func Assert(msgAndArgs ...any) {
}
func Run() int {
Assert("%v")
return 0
}
func Run2() int {
return Run()
}
b.go
:
package main
import "foo/pkg"
var A = pkg.Run2()
func main() {
}
GOEXPERIMENT=nounified go1.20 build ./b.go
What did you expect to see?
Build successfully.
What did you see instead?
# command-line-arguments
./b.go:5:5: internal compiler error: panic: interface conversion: ir.Node is *ir.BasicLit, not *ir.ConstExpr
Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (12 by maintainers)
Commits related to this issue
- cmd/compile/internal/staticinit: fix panic in interface conversion This patch fixes a panic from incorrect interface conversion from *ir.BasicLit to *ir.ConstExpr. This only occurs when nounified GOE... — committed to sywhang/go by sywhang a year ago
- cmd/compile/internal/staticinit: fix panic in interface conversion This patch fixes a panic from incorrect interface conversion from *ir.BasicLit to *ir.ConstExpr. This only occurs when nounified GOE... — committed to sywhang/go by sywhang a year ago
- cmd/compile/internal/staticinit: fix panic in interface conversion This patch fixes a panic from incorrect interface conversion from *ir.BasicLit to *ir.ConstExpr. This only occurs when nounified GOE... — committed to sywhang/go by sywhang a year ago
- cmd/compile/internal/staticinit: fix panic in interface conversion This patch fixes a panic from incorrect interface conversion from *ir.BasicLit to *ir.ConstExpr. This only occurs when nounified GOE... — committed to sywhang/go by sywhang a year ago
- cmd/compile/internal/staticinit: fix panic in interface conversion This patch fixes a panic from incorrect interface conversion from *ir.BasicLit to *ir.ConstExpr. This only occurs when nounified GOE... — committed to sywhang/go by sywhang a year ago
- cmd/compile: disable inline static init optimization There are a plenty of regression in 1.20 with this optimization. This CL disable inline static init, so it's safer to backport to 1.20 branch. Th... — committed to golang/go by cuonglm a year ago
- cmd/compile/internal/staticinit: fix panic in interface conversion This patch fixes a panic from incorrect interface conversion from *ir.BasicLit to *ir.ConstExpr. This only occurs when nounified GOE... — committed to Pryz/go by sywhang a year ago
- cmd/compile: disable inline static init optimization There are a plenty of regression in 1.20 with this optimization. This CL disable inline static init, so it's safer to backport to 1.20 branch. Th... — committed to Pryz/go by cuonglm a year ago
- cmd/compile: handle string concatenation in static init inliner Static init inliner is using typecheck.EvalConst to handle string concatenation expressions. But static init inliner may reveal constan... — committed to golang/go by cuonglm a year ago
- cmd/compile: reenable inline static init Updates #58293 Updates #58339 Fixes #58439 Change-Id: I06d2d92f86fa4a672d69515c4066d69d3e0fc75b Reviewed-on: https://go-review.googlesource.com/c/go/+/467016... — committed to golang/go by cuonglm a year ago
Unfortunately yes, we have some codegen based tooling that’s seeing huge build time regression due to almost 10x regression in calling gcexportdata.Read when we do not set that.
Will do. We do have plans to migrate that codegen toolchain not rely on gcexportdata before 1.21 is out but we’ll get back to you soon with some repro and profile after further investigation.