Skip to content

cmd/compile: incorrect stack trace for nil dereference in inlined function #27201

Closed
@robfig

Description

@robfig

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?

https://play.golang.org/p/V5EzYYYSDjz

What did you expect to see?

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

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

What did you see instead?

Incorrect attribution to an innocent function.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions