Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: missing inlined stack trace frame in index panic #29504
I have a (boiled down) very simple program. main calls f calls g. g calls h and indexes into an empty slice using the result of h.
I expect the index out of range stack trace to show the index panic happen in g, called from f, called from main. And it does:
This is correct.
But now I change the thing being indexed from a slice of 1-bytes to a slice of 2-bytes:
The stack trace no longer shows g. This is not correct.
In the actual program where this came up, my slice was of byte. Changing to slice of int also restores the stack trace. But something about indexing into a slice containing multibyte arrays is breaking the inlined stack trace information for an index panic for that operation.
Looks like we're not pulling the line numbers from quite the right place.
We should pass an explicit source position to all the panic-call-generating routines. Currently it just grabs the line number from the last-processed node, which is fragile.