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
cmd/compile: incorrect use of CMN on arm64 #50854
Comments
Given that this issue arose during code related to protocol buffers, we should probably also backport the fix (assuming it is trivial to just turn off this optimization). |
I see a whole bunch of CMN optimizations that give me the willies. |
Change https://golang.org/cl/381318 mentions this issue: |
@gopherbot, please backport to Go 1.16 and Go 1.17. This is an arm and arm64 compiler bug that generates incorrect code with the usual possibility of data corruption. The "fix" involves disabling an (incorrect) optimization in the "rules" (pattern-transmformations), so it is believed low risk. |
Backport issue(s) opened: #50866 (for 1.16), #50867 (for 1.17). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/381474 mentions this issue: |
Change https://golang.org/cl/381475 mentions this issue: |
So far so good. Note that -x <= p is implemented as NEG, CMP.
Now let's change the body of f: s/b/p <= y/.
Note that the NEG, CMP has changed to CMN. The CMN is wrong in the case where the comparison argument is -1<<63, since its negation is itself.
This optimization should not be applied when compiling -x <= p.
The text was updated successfully, but these errors were encountered: