-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: generates invalid instruction when using bit shifts on amd64 #38746
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
This code stopped compiling between go1.11 and go1.12, so I did a bisection and commit c6bf9a8 popped up, which seems right. |
Thank for reporting this, and thanks @marigonzes for the bisection. |
I suspect converting those rules to be strongly typed will fix this. Is anyone currently working on typing the amd64 rules? (We’ll need a test added either way.) |
It appears that just making this rule typed:
fixes at least the reproducer above. I don't think anyone is working on these amd64 rules at the moment. Will send a change to see if that's enough. |
That rule is just wrong. We need c<32 and d<32 as preconditions. |
Thanks. Holding the CL then. |
Change https://golang.org/cl/231977 mentions this issue: |
The {AND,OR,XOR}const ops can only take an int32 as an argument. Make sure that when rewriting a BTx op to one of these, the result has no high-order bits. Fixes golang#38746 Change-Id: Ia7c5f76952329f60974bc033c29a5433610f3b28 Reviewed-on: https://go-review.googlesource.com/c/go/+/231977 Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Josh Bleecher Snyder <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Using bit shifts to store data when a sequence of code causes a invalid instruction error:
invalid instruction: 00080 (invalid_test.go:22) ANDQ $9223372034707292159, CX
I have minimised the code example to the smallest amount of code that will reproduce the error.
What did you expect to see?
No error? or a pointer related error at worst
What did you see instead?
invalid instruction: 00080 (/Users/steve/Projects/kynrai/invalid_instruction/invalid_test.go:22) ANDQ $9223372034707292159, CX
The text was updated successfully, but these errors were encountered: