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: panic: interface conversion: types.Object is nil, not *ir.Name #67632

Closed
JetSetIlly opened this issue May 24, 2024 · 2 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.

Comments

@JetSetIlly
Copy link

JetSetIlly commented May 24, 2024

Go version

1.22.0

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/steve/.cache/go-build'
GOENV='/home/steve/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/steve/Go/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/steve/Go/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/steve/Go/go1.22.0/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/home/steve/Go/go1.22.0/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/steve/gopher2600/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3294028413=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Compilation of this project. https://github.com/JetSetIlly/Gopher2600/tree/compiler_panic_go1_22_0

The linked branch is the code that triggers the panic.

After I saw the panic I tried with Go versions 1.22.3 and gotip. Both of these versions work. I also tested with 1.21.7 and with the removal of some 1.22.x specific features that worked okay too.

The problem seems specific to 1.22.0

The project can be compiled with go build . but note that there are some cgo requirements.

What did you see happen?

Wben compiling with go build . the compiler panics with the following message.

# github.com/jetsetilly/gopher2600/hardware
hardware/vcs.go:242:2: internal compiler error: panic: interface conversion: types.Object is nil, not *ir.Name

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

The code at the quoted location is the last element of a const block. If I remove a replace instances of the consts with actual values, the panic moves to a different location.

What did you expect to see?

I expected the project to compile and to produce a single binary.

I would like to produce a smaller, compile-able example that exhibits the problem. But given the nature of the problem and it being unclear where the problem code is, that seems unlikley.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label May 24, 2024
@ALTree
Copy link
Member

ALTree commented May 24, 2024

Looks like #67016 which is fixed on tip; the fix was also backported to 1.22.3. I suggest upgrading your Go version.

@JetSetIlly
Copy link
Author

JetSetIlly commented May 24, 2024

Looks like #67016 which is fixed on tip; the fix was also backported to 1.22.3. I suggest upgrading your Go version.

Thanks. I've tested with 1.22.3 and indeed, the bug does not occur. I asked in the golang-dev mailing list and they said to raise a new issue. I suppose they want to be sure that it is the same bug.

But yes, that does look like the same bug. I was refactoring when this panic arose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

4 participants