-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Attempt at fixing mpmc_bounded_queue on 32bit where integer overflow is a concern. #10258
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
Conversation
There are |
(@alexcrichton is fixing the build failure as we speak.) |
@@ -34,7 +34,8 @@ use option::*; | |||
use vec; | |||
use clone::Clone; | |||
use kinds::Send; | |||
use num::{Exponential,Algebraic,Round}; | |||
use uint; | |||
use uint::next_power_of_two; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just use uint::next_power_of_two
rather than importing it specially?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy enough
I feel better about this now. The changes are commented and I think the checks are more clear. |
@brson @toffaletti Is this ready to merge? |
@catamorphism I think it is ready now. |
I still don't understand this change, and I think somebody needs to in order to merge it. |
As with @brson, I'm uncomfortable merging this when it appears that there aren't that many people understanding what's going on here. I would be comfortable landing this is someone else can be convinced of the correctness of the overflow handling, or possibly also if tests were added which exposed the bug as it stands today and shows that the changes fix it. |
Closing due to a lack of activity, but as always feel free to reopen with updates! |
Sorry, I've been out of the country for a few weeks. Can revisit this if it ever becomes an issue. |
I'm not super happy with this, I think I've probably missed some edge case and the logic is not at all straight forward. Maybe I should put the overflow logic into its own 'else if' and heavily comment it? Suggestions welcome.
P.S. - I couldn't actually compile this code because master doesn't build for me for some reason. I get:
I've tried
make clean
and./configure
again as well asrm -rf tmp x86_64-unknown-linux-gnu
.