-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
integer to floating point casts can cause undefined behaviour #10185
Comments
Nominating. |
accepting for P-backcompat-lang, same reasoning as #10184 |
I don't think this is backwards incompatible at a language level. It will not cause code that was working OK to stop working. Nominating. |
@pcwalton: It could cause code to stop working, because the results will change from arbitrary (but perhaps what the program wanted) values to whatever we decide to output when we branch on overflow ( |
changing to P-high, same reasoning as #10183. But we need to look into this more carefully, I do not yet know what the most recent IEEE 754 says about this case (nor do I know whether LLVM conforms to IEEE 754 2008 in this case ... ) I'd like to investigate that before really claiming to understand this. |
Is the example given in the issue actually undefined behaviour? 264 - 1 is in-range for Something that would be undefined would be |
I have confirmed on the llvm IRC channel that the intent is that it's UB only if the value is bigger than the biggest finite value. So this is actually not a problem in Rust unless we introduce |
This has now happened |
Sadness |
We already have an issue for this (#41799) which also has some code to reproduce the issue. Re-closing this as duplicate. |
Suppress the triggering of some lints in derived structures Fixes rust-lang#10185 Fixes rust-lang#10417 For `integer_arithmetic`, `arithmetic_side_effects` and `shadow_reuse`. * ~~Not sure how to test these use-cases so feel free to point any method or any related PR.~~ --- changelog: FP: [`integer_arithmetic`], [`arithmetic_side_effects`]: No longer lint inside proc macros [rust-lang#10203](rust-lang/rust-clippy#10203) <!-- changelog_checked -->
The text was updated successfully, but these errors were encountered: