-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
explain why we can mutate the FPU control word #114813
Conversation
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
// Sometimes killing UB with UB actually works... | ||
// (If this is used to set 32bit precision, there is still a risk that the compiler moves some 64bit | ||
// operation into the scope of the `set_precision` guard. So it's not like this is totally sound. | ||
// But it's not really any less sound than the default state of 80bit precision...) |
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.
I wonder if we can avoid this by relying on double-rounding being okay between f64 and f32. IOW, if we have set_precision
always set the precision to 64bit, then it should produce correct results even for 32bit operations -- and if the compiler chooses to reorder some 64bit operations then there's no problem.
r? @Amanieu |
@Amanieu friendly ping that this is waiting for your review. :) |
@bors r+ rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#113510 (Document soundness of Integer -> Pointer -> Integer conversions in `const` contexts.) - rust-lang#114412 (document our assumptions about symbols provided by the libc) - rust-lang#114813 (explain why we can mutate the FPU control word) - rust-lang#115523 (improve `AttrTokenStream`) - rust-lang#115536 (interpret: make MemPlace, Place, Operand types private to the interpreter) - rust-lang#115540 (Support debuginfo for custom MIR.) - rust-lang#115563 (llvm-wrapper: adapt for LLVM API change) r? `@ghost` `@rustbot` modify labels: rollup
This is usually not allowed (see rust-lang/stdarch#1454), but here we have a special case.