-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: bad line number attached to LEA instruction #22558
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
We have a theory about how to solve this, which is basically to stop splattering line numbers on everything unless we are really really sure a line number would be a good idea. I am happy to look into this for 1.10, I verified that it reproduces with the debugger changes I currently have pending. |
Looking at GOSSAFUNC output, I think line 67 is actually accurate here for the What's happening is the Further, for whatever reasons, the LEAQ instruction bubbles to the top of the function, where you noticed it. (And embarrassingly ends up needing to be spilled to a stack variable, even in optimized builds.) |
I looked into this yesterday, it happens because buildssa sticks pretty much every constant on the entry block of the function. So, yes, that's the correct IMHO altering the order of execution does count as optimization, and shouldn't happen in a -N build. If it's decided that it really doesn't matter where that instruction is executed, because it's a constant, then it should have its |
I can try this experiment pretty quickly, let me see how it goes. There's a few hours left to make the 1.10 beta. |
Change https://golang.org/cl/81215 mentions this issue: |
The issue here is It seems like the problem is
I'm sympathetic to the fact that this is a poor debugging experience, and understanding the 67 line took a fair amount of compiler knowledge, but I think this is a fairly strong interpretation of -N's intent. |
Yes, it's strong but I think it's reasonable. We're getting dangerously close to Theseus paradox, but I think an average user would expect a non-optimized build to not alter the control flow of the program for example wikipedia says:
|
This function gets compiled into this (with -N -l):
note the line number for 0x589d5a.
This also happens with 1.9.1, not a regression.
cc @heschik @dr2chase
The text was updated successfully, but these errors were encountered: