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: incorrect stack trace for nil dereference in inlined function #27201

robfig opened this Issue Aug 24, 2018 · 1 comment


None yet
4 participants

robfig commented Aug 24, 2018

I believe that the stack trace for panics that occur when computing arguments to an inlined function are incorrectly attributed to the inlined function. I'm not sure if this is a known / expected consequence of inlining, but it caused a lot of confusion to see a line identified where a nil dereference is impossible.

What version of Go are you using (go version)?

Go 1.10.3

Does this issue reproduce with the latest release?

Yes, it still exists in Go 1.11rc1

What did you do?

What did you expect to see?

A panic with this stack trace, identifying the line of the nil dereference:

goroutine 1 [running]:
	/tmp/sandbox722989325/main.go:10 +0x1a

What did you see instead?

Incorrect attribution to an innocent function.

goroutine 1 [running]:
	/tmp/sandbox722989325/main.go:10 +0x1a

@ianlancetaylor ianlancetaylor changed the title from Incorrect Stack Trace to cmd/compile: incorrect stack trace for nil dereference in inlined function Aug 24, 2018

@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Aug 24, 2018


This comment has been minimized.


randall77 commented Aug 24, 2018

Not sure what's going on here. Something with the inlining records, presumably.
The assembly instruction that does the nil dereference has the correct line number:

	0x001f 00031 (/Users/khr/gowork/issue27201.go:10)	MOVLQSX	(AX), AX


@odeke-em odeke-em self-assigned this Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment