-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: bad pointer in frame #32288
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
Comments
It looks like this is fixed on tip (
The nil pointer dereference is a correct error:
|
Yes, that's the real problem. Still, there should not be "fatal error". I'm not sure it is fixed in the tip. I can "fix" this code for 1.12.5 by removing one field from |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Never mind. My patch introduces a bug into the compiler. Sigh. It is different than @AlekSi's. I was distracted by the fact that they looked similar and arrived at the same time. |
As penance, I'll see about bisecting/investigating @AlekSi's. |
I bisected it down to 69c2c56. /cc @randall77 |
Slightly minimized version: package gobug
import (
"testing"
)
type T struct {
s [1]string
pad [16]uintptr
}
func f(t *int, p *int) []T {
var res []T
for {
var e *T
res = append(res, *e)
}
}
func TestGoBug(t *testing.T) {
f(nil, nil)
} Run with I've looked at this a bit but am out of time for now. Notes and impressions: Dereferencing The data on the stack for the temp for |
Tag I'm it :) I agree with your analysis.
After the VarDef, the autotmp is alive. But we load nil in to the source register, then call duffcopy. The duffcopy segfaults trying to copy from nil, without initializing the target. That leaves .autotmp_5 uninitialized, but live. I think we need to ensure that all instructions between a VarDef for a variable, and that variable being fully initialized, are not faulting instructions (or GC safepoints, for that matter). In this particular case, it looks like we got rid of the nil check in the late nilcheck elim pass. Before that pass, we have:
(v10 = MOVQconst [0].) After late nilcheck elim, v12 is gone. We might just need to treat VarDef as clearing the unnecessary list in nilcheckelim2. |
@randall77 sounds reasonable. But is it merely an accident that your mid-stack inlining CL is when this begins? When I looked, the generated code before/after was identical. |
I'm not sure about that part. |
Change https://golang.org/cl/179239 mentions this issue: |
I don't know why my CL was the culprit. But the test included in the CL I just mailed also fails on 1.11, so it can't be directly caused by my culprit, which landed in 1.12. This bug is very sensitive to what's left over on the stack, so it can come and go with any number of otherwise unrelated CLs. |
What did you do?
See https://github.com/AlekSi/go-bug.
What did you expect to see?
Normal panic due to bug in code:
What did you see instead?
Crash:
Full output
System details
The text was updated successfully, but these errors were encountered: