Skip to content
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

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

RalfJung
Copy link
Member

This is usually not allowed (see rust-lang/stdarch#1454), but here we have a special case.

@rustbot
Copy link
Collaborator

rustbot commented Aug 14, 2023

r? @m-ou-se

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 14, 2023
// 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...)
Copy link
Member Author

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.

@m-ou-se
Copy link
Member

m-ou-se commented Aug 15, 2023

r? @Amanieu

@rustbot rustbot assigned Amanieu and unassigned m-ou-se Aug 15, 2023
@RalfJung
Copy link
Member Author

RalfJung commented Sep 5, 2023

@Amanieu friendly ping that this is waiting for your review. :)

@Amanieu
Copy link
Member

Amanieu commented Sep 5, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 5, 2023

📌 Commit b4714a8 has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 5, 2023
…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
@bors bors merged commit 781253b into rust-lang:master Sep 5, 2023
11 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 5, 2023
@RalfJung RalfJung deleted the fpu-control branch September 5, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants