Skip to content

runtime: inlined function doesn't appear in stack trace #10152

@stvnrhodes

Description

@stvnrhodes

Let's say I have a struct like the one below.

type st struct {
    i *struct {
    j int
    }
}

Sometimes I forget to check if a field is nil. If I do a return statement that ends up dereferencing a nil pointer, like http://play.golang.org/p/WzyNpsiBam, I would expect the stack trace from the panic to be on the same line as the return statement. Instead, the stack trace indicates that the nil pointer dereference happened on the same line as the caller.

Interestingly, the same thing happens if I assign to a variable first.
http://play.golang.org/p/M3q3cSLgBk

If I enter another function before returning the variable, the stack trace is correct.
http://play.golang.org/p/eOZc34Uya7

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions