You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A version of github.com/kisielk/errcheck built from the current Go tip will panic when attempting to check anything, including its own main.go. A dlv stack trace says this happens in:
0 0x000000000043efc4 in runtime.fatalpanic
at /data/code/go-lang/go/src/runtime/panic.go:1217
1 0x000000000043dfbd in runtime.gopanic
at /data/code/go-lang/go/src/runtime/panic.go:779
2 0x00000000005fd665 in go/types.(*Checker).handleBailout
at /data/code/go-lang/go/src/go/types/check.go:366
3 0x00000000005fdfb3 in go/types.(*Checker).checkFiles.deferwrap1
at /data/code/go-lang/go/src/go/types/check.go:391
4 0x000000000043df96 in runtime.gopanic
at /data/code/go-lang/go/src/runtime/panic.go:770
5 0x000000000043d25e in runtime.panicmem
at /data/code/go-lang/go/src/runtime/panic.go:261
6 0x00000000004566c5 in runtime.sigpanic
at /data/code/go-lang/go/src/runtime/signal_unix.go:866
7 0x0000000000660bec in go/types.(*StdSizes).Sizeof
at /data/code/go-lang/go/src/go/types/sizes.go:228
8 0x0000000000694a2e in go/types.Sizes.Sizeof-fm
at <autogenerated>:1
9 0x00000000006616eb in go/types.(*Config).sizeof
at /data/code/go-lang/go/src/go/types/sizes.go:333
10 0x0000000000601019 in go/types.representableConst.func1
at /data/code/go-lang/go/src/go/types/const.go:76
11 0x0000000000600389 in go/types.representableConst
at /data/code/go-lang/go/src/go/types/const.go:92
12 0x000000000060154f in go/types.(*Checker).representation
at /data/code/go-lang/go/src/go/types/const.go:256
13 0x0000000000615b97 in go/types.(*Checker).implicitTypeAndValue
at /data/code/go-lang/go/src/go/types/expr.go:375
14 0x00000000005e0a33 in go/types.(*Checker).assignment
at /data/code/go-lang/go/src/go/types/assignments.go:52
15 0x00000000005e1a4e in go/types.(*Checker).initConst
at /data/code/go-lang/go/src/go/types/assignments.go:126
16 0x000000000060b014 in go/types.(*Checker).constDecl
at /data/code/go-lang/go/src/go/types/decl.go:490
17 0x000000000060789f in go/types.(*Checker).objDecl
at /data/code/go-lang/go/src/go/types/decl.go:191
18 0x00000000006574d2 in go/types.(*Checker).packageObjects
at /data/code/go-lang/go/src/go/types/resolver.go:693
19 0x00000000005fdb0b in go/types.(*Checker).checkFiles
at /data/code/go-lang/go/src/go/types/check.go:407
20 0x00000000005fd6e5 in go/types.(*Checker).Files
at /data/code/go-lang/go/src/go/types/check.go:371
21 0x0000000000713365 in golang.org/x/tools/go/packages.(*loader).loadPackage
at /homes/hawkwind/u0/cks/go/pkg/mod/golang.org/x/tools@v0.9.1/go/packages/packages.go:1052
[...]
The first non-panic related frame appears to be frame 7, where dlv says the panicing line is return s.WordSize // catch-all and s is nil.
Reproduction is straightforward:
cd /tmp
git clone https://github.com/kisielk/errcheck
cd errcheck
go build -o errcheck.bin
./errcheck.bin main.go
[panic]
I believe this has been happening in the development version for some unknown length of time, but it doesn't happen with Go 1.21.
What did you expect to see?
No panic.
What did you see instead?
The panic above.
The text was updated successfully, but these errors were encountered:
Turns out a wrong type assertion to *types.StdSizes from a *types.gcSizes was causing the sizes to be nil here. Later on in *go/types/stdSizes.Sizeof it tries to access WordSize from s which is nil resulting in the segmentation fault.
Closing as this is an x/tools issue that is already fixed.
Go version
go version devel go1.22-37aed23f51 Wed Nov 22 19:53:59 2023 +0000 linux/amd64
Reproducibility
What operating system and processor architecture are you using (
go env
)?What did you do?
A version of github.com/kisielk/errcheck built from the current Go tip will panic when attempting to check anything, including its own main.go. A dlv stack trace says this happens in:
The first non-panic related frame appears to be frame 7, where dlv says the panicing line is
return s.WordSize // catch-all
and s is nil.Reproduction is straightforward:
I believe this has been happening in the development version for some unknown length of time, but it doesn't happen with Go 1.21.
What did you expect to see?
No panic.
What did you see instead?
The panic above.
The text was updated successfully, but these errors were encountered: