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

panic: runtime error: invalid memory address or nil pointer dereference [recovered] #180

Open
JasonWu0506 opened this issue Apr 18, 2024 · 5 comments

Comments

@JasonWu0506
Copy link

go-callvis
v0.7.0 built from git (unknown)
run go-callvis ${package}
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1024ec084]

goroutine 61 [running]:
go/types.(*Checker).handleBailout(0x14000034200, 0x1400013fb98)
/opt/homebrew/opt/go/libexec/src/go/types/check.go:367 +0x9c
panic({0x102a27f60?, 0x102df17b0?})
/opt/homebrew/opt/go/libexec/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x102ac4650, 0x102df84e0})
/opt/homebrew/opt/go/libexec/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
/opt/homebrew/opt/go/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0x102ac4650?, 0x102df84e0?})
/opt/homebrew/opt/go/libexec/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x102ac7888, 0x102e44a20}, 0x14000034200, 0x102df84e0, 0x1400013df98)
/opt/homebrew/opt/go/libexec/src/go/types/const.go:92 +0x138
go/types.(*Checker).representation(0x14000034200, 0x140004eb180, 0x102df84e0)
/opt/homebrew/opt/go/libexec/src/go/types/const.go:256 +0x68
go/types.(*Checker).implicitTypeAndValue(0x14000034200, 0x140004eb180, {0x102ac4650, 0x102df84e0})
/opt/homebrew/opt/go/libexec/src/go/types/expr.go:375 +0x304
go/types.(*Checker).convertUntyped(0x14000034200, 0x140004eb180, {0x102ac4650, 0x102df84e0})
/opt/homebrew/opt/go/libexec/src/go/types/const.go:289 +0x30
go/types.(*Checker).matchTypes(0x14000034200, 0x140004eb140, 0x140004eb180)
/opt/homebrew/opt/go/libexec/src/go/types/expr.go:926 +0x7c

@fuchao1999
Copy link

go v1.22
go-callvis v0.7.0 built from git (unknown)

go-callvis .
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x95d56f]

goroutine 228 [running]:
go/types.(*Checker).handleBailout(0xc000550600, 0xc000a7fbd0)
D:/Go/src/go/types/check.go:367 +0x88
panic({0xc628a0?, 0x10eaf50?})
D:/Go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xdc4a38, 0x10f11c0})
D:/Go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
D:/Go/src/go/types/sizes.go:333
go/types.representableConst.func1({0xdc4a38?, 0x10f11c0?})
D:/Go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xdc7a38, 0x10c8990}, 0xc000550600, 0x10f11c0, 0xc000a7dd70)
D:/Go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc000550600, 0xc00039dd40, 0x10f11c0)
D:/Go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000550600, 0xc00039dd40, {0xdc4a38, 0x10f11c0})
D:/Go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).assignment(0xc000550600, 0xc00039dd40, {0xdc4a38, 0x10f11c0}, {0xcec92b, 0xe})
D:/Go/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).exprInternal(0xc000550600, 0x0, 0xc00039dd40, {0xdc6c00, 0xc00039c780}, {0xdc4a88, 0xc0003f6070})
D:/Go/src/go/types/expr.go:1175 +0x267a
go/types.(*Checker).rawExpr(0xc000550600, 0x0, 0xc00039dd40, {0xdc6c00?, 0xc00039c780?}, {0xdc4a88?, 0xc0003f6070?}, 0x0)
D:/Go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).exprWithHint(0xc000550600, 0xc00039dd40, {0xdc6c00, 0xc00039c780}, {0xdc4a88, 0xc0003f6070})
D:/Go/src/go/types/expr.go:1563 +0x65
go/types.(*Checker).indexedElts(0xc000550600, {0xc000550000, 0x1b, 0xc000a7ee30?}, {0xdc4a88, 0xc0003f6070}, 0xffffffffffffffff)
D:/Go/src/go/types/index.go:453 +0x129
go/types.(*Checker).exprInternal(0xc000550600, 0x0, 0xc00039d600, {0xdc6c00, 0xc00039cf40}, {0x0, 0x0})
D:/Go/src/go/types/expr.go:1247 +0x10dd
go/types.(*Checker).rawExpr(0xc000550600, 0x0, 0xc00039d600, {0xdc6c00?, 0xc00039cf40?}, {0x0?, 0x0?}, 0x0)
D:/Go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc000550600, 0x0?, 0xc00039d600, {0xdc6c00?, 0xc00039cf40?})
D:/Go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).varDecl(0xc000550600, 0xc000b03260, {0xc000306188, 0x1, 0x1}, {0x0, 0x0}, {0xdc6c00, 0xc00039cf40})
D:/Go/src/go/types/decl.go:521 +0x17b
go/types.(*Checker).objDecl(0xc000550600, {0xdce798, 0xc000b03260}, 0x0)
D:/Go/src/go/types/decl.go:194 +0x9e5
go/types.(*Checker).packageObjects(0xc000550600)
D:/Go/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc000550600, {0xc000306008, 0x1, 0x1})
D:/Go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
D:/Go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc00019c000, 0xc000747500)
F:/Workspaces/GoLand/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:1052 +0xa72
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
F:/Workspaces/GoLand/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:851 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
D:/Go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
D:/Go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0xc000b45fd0?)
F:/Workspaces/GoLand/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:839 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
F:/Workspaces/GoLand/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:846 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 168
F:/Workspaces/GoLand/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:845 +0x94

@starZane
Copy link

It seems that only go1.22 version will report this error. I tried to change to go1.21 version and compiled it and it worked normally.

@lichenglife
Copy link

lichenglife commented Sep 12, 2024

After I switched to go1.21.2, it still not work

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x62b5af]

goroutine 114 [running]:
go/types.(*Checker).handleBailout(0xc0002d6000, 0xc0002abbd0)
/usr/local/go/src/go/types/check.go:367 +0x88
panic({0xaac9c0?, 0x11bbcb0?})
/usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xc26f38, 0x11c29e0})
/usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
/usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0xc26f38?, 0x11c29e0?})
/usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0xc2a208, 0x1211d88}, 0xc0002d6000, 0x11c29e0, 0xc0002a9d70)
/usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc0002d6000, 0xc0002b3bc0, 0x11c29e0)
/usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc0002d6000, 0xc0002b3bc0, {0xc26f38, 0x11c29e0})
/usr/local/go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).assignment(0xc0002d6000, 0xc0002b3bc0, {0xc26f38, 0x11c29e0}, {0xb47584, 0xe})
/usr/local/go/src/go/types/assignments.go:52 +0x2e5
go/types.(*Checker).exprInternal(0xc0002d6000, 0x0, 0xc0002b3bc0, {0xc29120, 0xc0002b2900}, {0xc26f88, 0xc0001b20e0})
/usr/local/go/src/go/types/expr.go:1175 +0x267a
go/types.(*Checker).rawExpr(0xc0002d6000, 0x0, 0xc0002b3bc0, {0xc29120?, 0xc0002b2900?}, {0xc26f88?, 0xc0001b20e0?}, 0x0)
/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).exprWithHint(0xc0002d6000, 0xc0002b3bc0, {0xc29120, 0xc0002b2900}, {0xc26f88, 0xc0001b20e0})
/usr/local/go/src/go/types/expr.go:1563 +0x65
go/types.(*Checker).indexedElts(0xc0002d6000, {0xc000259c00, 0x14, 0xc000108e30?}, {0xc26f88, 0xc0001b20e0}, 0xffffffffffffffff)
/usr/local/go/src/go/types/index.go:453 +0x129
go/types.(*Checker).exprInternal(0xc0002d6000, 0x0, 0xc0002b3100, {0xc29120, 0xc0002b2ac0}, {0x0, 0x0})
/usr/local/go/src/go/types/expr.go:1247 +0x10dd
go/types.(*Checker).rawExpr(0xc0002d6000, 0x0, 0xc0002b3100, {0xc29120?, 0xc0002b2ac0?}, {0x0?, 0x0?}, 0x0)
/usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc0002d6000, 0x0?, 0xc0002b3100, {0xc29120?, 0xc0002b2ac0?})
/usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).varDecl(0xc0002d6000, 0xc000182fc0, {0xc000070418, 0x1, 0x1}, {0x0, 0x0}, {0xc29120, 0xc0002b2ac0})
/usr/local/go/src/go/types/decl.go:521 +0x17b
go/types.(*Checker).objDecl(0xc0002d6000, {0xc314d8, 0xc000182fc0}, 0x0)
/usr/local/go/src/go/types/decl.go:194 +0x9e5
go/types.(*Checker).packageObjects(0xc0002d6000)
/usr/local/go/src/go/types/resolver.go:693 +0x4dd
go/types.(*Checker).checkFiles(0xc0002d6000, {0xc000070328, 0x1, 0x1})
/usr/local/go/src/go/types/check.go:408 +0x1a5
go/types.(*Checker).Files(...)
/usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc00014e000, 0xc00007f6e0)
/workplace/gopath/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:1052 +0xa72
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
/workplace/gopath/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:851 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
/usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
/usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
/workplace/gopath/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:839 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
/workplace/gopath/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:846 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 48
/workplace/gopath/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:845 +0x94

@bbkane
Copy link

bbkane commented Sep 14, 2024

I'm getting a similar panic when I try to get the callgraph for https://github.com/bbkane/envelope/

$ go-callvis -version
v0.7.0 built from git (unknown)
master:* 21:57:34.636 PDT pop-os:~/Git-GH/envelope
$ go-callvis go.bbkane.com/envelope
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6217ef]

goroutine 317 [running]:
go/types.(*Checker).handleBailout(0xc000a8d180, 0xc00071fbf0)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/check.go:404 +0x88
panic({0xad1ca0?, 0x100fdc0?})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/runtime/panic.go:785 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0xc567c0, 0x1016cc0})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/sizes.go:229 +0x30f
go/types.(*Config).sizeof(...)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/sizes.go:334
go/types.representableConst.func1({0xc567c0?, 0x1016cc0?})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/const.go:77 +0x86
go/types.representableConst({0xc5a200, 0x1067040}, 0xc000a8d180, 0x1016cc0, 0xc00071eea0)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/const.go:93 +0x173
go/types.(*Checker).representation(0xc000a8d180, 0xc000115040, 0x1016cc0)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/const.go:257 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000a8d180, 0xc000115040, {0xc567c0, 0x1016cc0})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/expr.go:377 +0x2d7
go/types.(*Checker).assignment(0xc000a8d180, 0xc000115040, {0xc567c0, 0x1016cc0}, {0xb73aaa, 0x10})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/assignments.go:70 +0x451
go/types.(*Checker).initVar(0xc000a8d180, 0xc0009a5740, 0xc000115040, {0xb73aaa, 0x10})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/assignments.go:181 +0x428
go/types.(*Checker).initVars(0xc000a8d180, {0xc00022e278, 0x1, 0x0?}, {0xc000514070, 0xb6dba3?, 0x3?}, {0xc58ed0, 0xc000130ae0})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/assignments.go:399 +0x638
go/types.(*Checker).stmt(0xc000a8d180, 0x0, {0xc58ed0, 0xc000130ae0})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/stmt.go:533 +0x1777
go/types.(*Checker).stmtList(0xc000a8d180, 0x0, {0xc000514080?, 0x5e9c60?, 0xc000a8d180?})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc000a8d180, 0xc58c30?, {0xc0002941b4?, 0xa?}, 0xc000114fc0, 0xc000217560, {0x0?, 0x0?})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/stmt.go:41 +0x2f3
go/types.(*Checker).funcDecl.func1()
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/decl.go:888 +0x3a
go/types.(*Checker).processDelayed(0xc000a8d180, 0x0)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/check.go:516 +0x15c
go/types.(*Checker).checkFiles(0xc000a8d180, {0xc0004ea030, 0x2, 0x2})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/check.go:462 +0x17e
go/types.(*Checker).Files(0xc0001da0e0?, {0xc0004ea030?, 0xc0004aa1e0?, 0x6?})
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/go/types/check.go:422 +0x75
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0001da0e0, 0xc0000f9cb0)
        /home/bbkane/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:1052 +0xa32
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
        /home/bbkane/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:851 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/sync/once.go:76 +0xb4
sync.(*Once).Do(...)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.23.1/libexec/src/sync/once.go:67
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
        /home/bbkane/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:839 +0x3b
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
        /home/bbkane/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:846 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 306
        /home/bbkane/go/pkg/mod/golang.org/x/[email protected]/go/packages/packages.go:845 +0x94

@myysophia
Copy link

go-callvis --version
v0.7.0 built from git (unknown)

mee too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants