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: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference [1.18 backport] #54308

Closed
gopherbot opened this issue Aug 5, 2022 · 6 comments
Labels
CherryPickCandidate Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@mdempsky requested issue #54302 to be considered for backport to the next 1.18 minor release.

@gopherbot Please backport to Go 1.19. This is a regression from Go 1.18.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Aug 5, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 5, 2022
@gopherbot gopherbot added this to the Go1.18.6 milestone Aug 5, 2022
@mdempsky
Copy link
Member

mdempsky commented Aug 5, 2022

gopherbot is not yet sentient.

@mdempsky mdempsky closed this as completed Aug 5, 2022
@mdempsky
Copy link
Member

mdempsky commented Aug 8, 2022

Reportedly this affects Go 1.18.5 too.

The fix is very non-invasive, so maybe we should still consider it for backporting to Go 1.18, if it's something that worked in earlier 1.18 point releases.

@randall77
Copy link
Contributor

I'm happy to backport as the CL is clearly safe.

@mdempsky
Copy link
Member

mdempsky commented Aug 8, 2022

In Go 1.18.5, DynamicTypeAssertExpr still had just one T field. It wasn't split into the separate RType and ITab fields until 2a6e138 (which I can see added the issue), and was first released in Go 1.19. So I don't think there's anything to backport actually.

I'm also not able to reproduce the minimized test case failure with Go 1.18.

@borzovplus You said this issue is affecting you with Go 1.18.5? Can you please file a new issue with repro steps? Thanks.

@mdempsky mdempsky closed this as completed Aug 8, 2022
@borzovplus
Copy link

In Go 1.18.5, DynamicTypeAssertExpr still had just one T field. It wasn't split into the separate RType and ITab fields until 2a6e138 (which I can see added the issue), and was first released in Go 1.19. So I don't think there's anything to backport actually.

I'm also not able to reproduce the minimized test case failure with Go 1.18.

@borzovplus You said this issue is affecting you with Go 1.18.5? Can you please file a new issue with repro steps? Thanks.

unfortunately, I didn't figure out how to lay out the playback steps correctly for the new issue, so I attach the archive of the test project where this problem is reproduced in 1.18.5 and also in 1.19 (it might be worth checking out your fix on this project)

test.zip

@mdempsky
Copy link
Member

mdempsky commented Aug 9, 2022

@borzovplus Thanks, I can reproduce the failure. It looks like a regression introduced in Go 1.18.4. I can also confirm it's unrelated to this issue.

The back trace with -gcflags=-h is:

# test
./api/common/api.go:37:8: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: -h
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xbfe5c5]

goroutine 1 [running]:
cmd/compile/internal/base.hcrash()
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/base/print.go:264 +0x58
cmd/compile/internal/base.FatalfAt({0x17e270?, 0xc0?}, {0xd244f1, 0x9}, {0xc00079f218, 0x1, 0x1})
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/base/print.go:232 +0x20f
cmd/compile/internal/base.Fatalf(...)
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/gc.handlePanic()
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/gc/main.go:49 +0x85
panic({0xcadc80, 0x1316dd0})
	/home/mdempsky/wd/go1.18.5/src/runtime/panic.go:838 +0x207
cmd/compile/internal/noder.(*genInst).getDictionarySym(0x139fe00, 0xc0000fd380, {0xc000493840, 0x2, 0x2}, 0x1)
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/stencil.go:1637 +0xf85
cmd/compile/internal/noder.(*genInst).instantiateMethods(0xc00007f560?)
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/stencil.go:564 +0x133
cmd/compile/internal/noder.(*genInst).buildInstantiations(0x139fe00)
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/stencil.go:55 +0x33
cmd/compile/internal/noder.BuildInstantiations(...)
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/stencil.go:44
cmd/compile/internal/noder.(*irgen).generate(0xc0005ba0c0, {0xc00000e428, 0x1, 0x203000?})
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/irgen.go:331 +0x3d1
cmd/compile/internal/noder.check2({0xc00000e428, 0x1, 0x1})
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/irgen.go:92 +0x16d
cmd/compile/internal/noder.LoadPackage({0xc00001e260, 0x1, 0x0?})
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/noder/noder.go:90 +0x335
cmd/compile/internal/gc.Main(0xd54710)
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/internal/gc/main.go:191 +0xb13
main.main()
	/home/mdempsky/wd/go1.18.5/src/cmd/compile/main.go:55 +0xdd

I'll file a new issue once I have a shorter repro.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickCandidate Used during the release process for point releases compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

4 participants