Go version
1.25rc1
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='on'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/user/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/user/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build876450102=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/home/user/go-repos/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/user/go-repos:/opt/go/path:/home/user/go-code'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/user/golang'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/user/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/user/golang/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.25rc1'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Go 1.25 seemingly introduced some changes that make some code not panic anymore. A minimal repro can be found as following: * Go 1.24.4 (panics): https://go.dev/play/p/yVGJr9Fto9s * Go 1.25rc1 (doesn't panic): https://go.dev/play/p/yVGJr9Fto9s?v=gotip
What did you see happen?
The code did not panic on go 1.25rc1 but it used to do on 1.24.4 and before.
What did you expect to see?
After doing some bisecting, the offending commit seems to be https://github.com/golang/go/commit/ed24bb4e6047890af272733c5a8bdcc43834e517 . In both the repros above and the commit message fmt.Println
is used, which receives an interface.
Comment From: thepudds
Thanks for the report. I'll take a look.
Comment From: thepudds
OK, I might see the problem, though I want to poke at it a bit more.
Comment From: gabyhelp
Related Issues
- cmd/compile: panic: interface conversion: interface is nil, not gc.SliceType #15530 (closed)
- cmd/compile: panic during import method expression #48088 (closed)
- x/tools/gopls: panic: interface conversion: *types.Basic is not typesinternal.NamedOrAlias: missing method Obj #71136 (closed)
- cmd/compile: Go1.22RC1 compiler crash when using GOEXPERIMENT=rangefunc #64930 (closed)
- cmd/compile: unexpected panic introduced with c08b01e #25776 (closed)
- Escape analysis caused unintuitive behavior #27644 (closed)
- gopls panics on interface conversion in printf/printf.go #33911 (closed)
- `defer recover()` does not recover from panic #53169 (closed)
- expvar: panic: interface conversion: interface is nil, not expvar.Var #53422 (closed)
- cmd/compile: compiler crash on failing to get Right parenthesis in Go1.9 #19667 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Comment From: gopherbot
Change https://go.dev/cl/684116 mentions this issue: cmd/compile/internal/escape: evaluate any side effects when replacing ConvExpr.X for interface conversions
Comment From: thepudds
Hi @sggutier, I need to check and possibly update a couple of other places, but I have a WIP CL 684116 that at least seems to restore expected behavior on your small example:
$ go run . # want a panic
panic: test error
goroutine 1 [running]:
main.crashOnErr(...)
cmd/compile/internal/escape/_examples/issue-74379/main.go:10
main.main()
cmd/compile/internal/escape/_examples/issue-74379/main.go:16 +0x3d
exit status 2
I am still looking at it, but when you have a chance, would you mind trying that CL 684116 on whatever the original problem code was to see if it helps?
One way is via the official gotip
utility:
$ go install golang.org/dl/gotip@latest # install gotip
$ gotip download 684116 # download and build CL 684116
$ gotip test ./... # use gotip as your normal 'go' command
Thanks again for the report, and thanks for the minimal reproducer!
Comment From: sggutier
Thank you so much for the quick response @thepudds, that does indeed solve my issue!