Skip to content

cmd/compile: internal compiler error: panic: interface conversion: ir.Node is *ir.CompLitExpr, not *ir.Name #58325

Closed
@evanj

Description

@evanj

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/evan.jones/Library/Caches/go-build"
GOENV="/Users/evan.jones/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/evan.jones/go/pkg/mod"
GONOPROXY=""
GOOS="darwin"
GOPATH="/Users/evan.jones/go"
GOPRIVATE=""
GOROOT="/Users/evan.jones/go120"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/evan.jones/go120/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.20"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/evan.jones/go120bug/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/g1/97d8s0r57hj4nv4_qd3fqcrm0000gp/T/go-build1938067015=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Attempt to run the following program with Go 1.20

package main

type BugStruct struct {
	wrappedint IntWrapper
}

type IntWrapper struct {
	int
}

func (IntWrapper) Make() IntWrapper {
	return IntWrapper{5}
}

// FromWire decodes trace ID from the data transferred over the wire
func (BugStruct) Make() BugStruct {
	return BugStruct{
		wrappedint: IntWrapper{}.Make(),
	}
}

// triggers the ICE
var somevalue = BugStruct{}.Make()

// does not trigger the ICE
// var somevalue = bugsubpackage.IntWrapper{}.Make()

func main() {}

(this is a silly example, but it was extracted and minimized from a much larger program while trying to get Go 1.20 running)

What did you expect to see?

The binary runs successfully and does nothing.

What did you see instead?

# example.go/go120bug
./bug.go:23:5: internal compiler error: panic: interface conversion: ir.Node is *ir.CompLitExpr, not *ir.Name

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions