-
Notifications
You must be signed in to change notification settings - Fork 126
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
Bug in some shift/rotates #1191
Comments
I just added some So it appears that the "number of bits in shift amount" parameter to I believe the bug is on this line: cryptol/src/Cryptol/Backend/WordValue.hs Line 580 in 282613d
The second-to-last argument, n is actually the width of the shifted array, when it should instead be the width of the index.
|
Yep, that looks like the likely culprit. I guess I should go through and audit all the uses of EDIT: fixing that line does indeed seem like it fixes the bug, and other uses of the barrel shifter are correctly using the number of index bits for that argument. I'll put together a patch, and take the opportunity to add some documentation to these functions while I'm in there. |
Consider the following:
I expect
q0
,q1
andq2
to all compute the same answer. However, in current master,q2
computes the wrong value. The other shift and rotate operations are also broken in similar ways. Probably, the culprit is the code path that computes results when both arguments of a shift or rotate are unpacked bit vectors, as the example starts working correctly when either argument is packed.The text was updated successfully, but these errors were encountered: