-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
add notes about non-compliant FP behavior on 32bit x86 targets #113053
Conversation
r? @JohnTitor (rustbot has picked a reviewer for you, use r? to override) |
Note that even on targets with SSE enabled, |
My assumption was that this would mangle returned NANs but not affect computation/rounding, i.e. SSE is used for all arithmetic. IIRC this is what has been stated in prior discussions. |
https://godbolt.org/z/av8PK14j9 |
It seems pretty good from a "get sensible predictable behavior" perspective so I'd say we take this and go complain if they ever change it. ;) |
☔ The latest upstream changes (presumably #113049) made this pull request unmergeable. Please resolve the merge conflicts. |
Did a quick check and this to be right everywhere (and if I'm mistaken people can file followups), so it seems fine to me now. Assuming we don't need lang or opsem approval for this (my hunch is we don't as this simply documents the current state of the world, and does not introduce any guarantees), you can r=me after you fix the conflicts. |
Looking at #72327, turns out that even on |
9a4e37b
to
45fecfd
Compare
That issue is straight up a codegen bug, cf. llvm/llvm-project#44218. Also, re: the note, loading a NaN onto the x87 stack only destroys its payload if it's a signaling NaN. Do these changes preclude future improvements to the Rust calling convention to avoid the x87 stack for function returns when SSE registers are available? Also with the exception of the C calling convention making it almost impossible to return an sNaN, the desired semantics are entirely implementable. I was actually planning on starting to fix that stuff in LLVM once I return to my desk in August. |
Rust Compilers can general do whatever they want with I'd prefer if this isn't necessarily required, though. |
Well, codegen is using the target FP operations, but those just don't have the right behavior. As far as I understand this is a long-standing problem affecting pretty much all C compilers on that target, which is why I think it is a target bug.
No, we can always improve a target's compliance later. Even a custom Rust calling convention won't entirely solve the problem though as the C calling convention can still be used for Rust-to-Rust calls.
That would be great, being able to remove these footnotes would make me very happy. :) I am proposing we add them because this has been the situation for years and it's pretty much outside our control -- at least that was my impression. |
Yes, the problems are fundamentally LLVM bugs and not Rust's fault beyond using a buggy backend. However, note that the target operations aren't completely at fault. Both issues can be fixed by setting the precision flag correctly. In fact, those specific code samples won't reproduce the bug on Windows, since the MSVCRT sets the x87 unit to 53-bit precision, which matches the destination. |
Isn't modifying the FPCW slow off of Windows, since IIRC you have to reset the precision whenever you call another function. |
I'm given to understand that changing the control word is somewhat slow, but not fatally so. However, code typically doesn't use multiple precisions at once, and predictability and correctness trump performance regardless. If you want both top performance and predictability on pre-SSE hardware, you should stick to 80 bit floats anyway. You'll get better numerical results too. Regarding calling conventions, I was pretty sure that none of them specified the state of the control word? |
Sys-V relies on it being 80-bit to do
That being said, it seems like a considerable pessimization to me, as having to change the control word twice arround function calls adds up. |
According to https://raw.githubusercontent.com/wiki/hjl-tools/x86-psABI/intel386-psABI-1.1.pdf and https://gitlab.com/x86-psABIs/i386-ABI/-/blob/hjl/master/low-level-sys-info.tex the callee (not the caller) must preserve the control word across calls. In theory, this pessimization should already be in effect. |
It also gives the state of the register on startup, but doesn't say anything about it's value on function entry. That being said, compilers do assume the state of the |
To be clear, it is in fact compiled wrong according to that document, at least if the compiler claims to implement the i386 SYSV ABI. Section 2.2.1 Registers, page 10 says "The x87 status word register is caller-saved, whereas the x87 control word is callee-saved.". Additionally, the last row of table 2.3 (Register usage) also says that the callee must preserve the control word. |
Being callee-saved vs. caller-saved is moot unless the function modifies the value of the register. |
6c50588
to
6981482
Compare
@@ -192,6 +195,8 @@ target | std | notes | |||
`x86_64-unknown-redox` | ✓ | Redox OS | |||
[`x86_64-unknown-uefi`](platform-support/unknown-uefi.md) | * | 64-bit UEFI | |||
|
|||
[^x86_32-floats-x87]: Floating-point support on `i586` targets is non-compliant: the `x87` registers and instructions used for these targets do not provide IEEE-754-compliant behavior, in particular when it comes to rounding and NaN payload bits. See [issue #114479][x86-32-float-issue]. |
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.
One thing that's currently not mentioned is that even on some tier 1 targets, with the right flags you can run into the x87 issue -- e.g. by setting -C target-cpu=pentium
on a i686 target, which disables SSE2. I'm not sure what the status is of such flags (is that even still a tier 1 target?) and how to best put this into the docs.
☔ The latest upstream changes (presumably #115769) made this pull request unmergeable. Please resolve the merge conflicts. |
Apologies, allow me to catch up... |
Does #115919 affect anything in here? I've lost track... |
@RalfJung r=me with this rebased, if we have to correct this again then we have to correct this again. |
Two more i686 targets have been added recently:
I assume both of these have SSE and are thus affected by the return-val issue but not the x87-precision issue. |
@bors r=workingjubilee rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#113053 (add notes about non-compliant FP behavior on 32bit x86 targets) - rust-lang#115726 (For a single impl candidate, try to unify it with error trait ref) - rust-lang#116158 (Don't suggest nonsense suggestions for unconstrained type vars in `note_source_of_type_mismatch_constraint`) - rust-lang#116351 (Add `must_use` on pointer equality functions) - rust-lang#116355 (Clarify float rounding direction for signed zero) - rust-lang#116361 (Bump stdarch submodule) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#113053 - RalfJung:x86_32-float, r=workingjubilee add notes about non-compliant FP behavior on 32bit x86 targets Based on ton of prior discussion (see all the issues linked from rust-lang/unsafe-code-guidelines#237), the consensus seems to be that these targets are simply cursed and we cannot implement the desired semantics for them. I hope I properly understood what exactly the extent of the curse is here, let's make sure people with more in-depth FP knowledge take a close look! In particular for the tier 3 targets I have no clue which target is affected by which particular variant of the x86_32 FP curse. I assumed that `i686` meant SSE is used so the "floating point return value" is the only problem, while everything lower (`i586`, `i386`) meant x87 is used. I opened rust-lang#114479 to concisely describe and track the issue. Cc `@workingjubilee` `@thomcc` `@chorman0773` `@rust-lang/opsem` Fixes rust-lang#73288 Fixes rust-lang#72327
23: Fix divergence from upstream `master` r=tshepang a=pvdrz * rust-lang/rust#116381 * rust-lang/rust#116360 * rust-lang/rust#116353 * rust-lang/rust#116406 * rust-lang/rust#116408 * rust-lang/rust#116395 * rust-lang/rust#116393 * rust-lang/rust#116388 * rust-lang/rust#116365 * rust-lang/rust#116363 * rust-lang/rust#116146 * rust-lang/rust#115961 * rust-lang/rust#116386 * rust-lang/rust#116367 * rust-lang/rust#105394 * rust-lang/rust#115301 * rust-lang/rust#116384 * rust-lang/rust#116379 * rust-lang/rust#116328 * rust-lang/rust#116282 * rust-lang/rust#116261 * rust-lang/rust#114654 * rust-lang/rust#116376 * rust-lang/rust#116374 * rust-lang/rust#116371 * rust-lang/rust#116358 * rust-lang/rust#116210 * rust-lang/rust#115863 * rust-lang/rust#115025 * rust-lang/rust#116372 * rust-lang/rust#116361 * rust-lang/rust#116355 * rust-lang/rust#116351 * rust-lang/rust#116158 * rust-lang/rust#115726 * rust-lang/rust#113053 * rust-lang/rust#116083 * rust-lang/rust#102099 * rust-lang/rust#116356 * rust-lang/rust#116350 * rust-lang/rust#116349 * rust-lang/rust#116289 * rust-lang/rust#114454 * rust-lang/rust#114453 * rust-lang/rust#116331 * rust-lang/rust#116346 * rust-lang/rust#116340 * rust-lang/rust#116326 * rust-lang/rust#116313 * rust-lang/rust#116276 * rust-lang/rust#115898 * rust-lang/rust#116325 * rust-lang/rust#116317 * rust-lang/rust#116207 * rust-lang/rust#116281 * rust-lang/rust#116304 * rust-lang/rust#116259 * rust-lang/rust#116228 * rust-lang/rust#116224 * rust-lang/rust#115554 * rust-lang/rust#116311 * rust-lang/rust#116299 * rust-lang/rust#116295 * rust-lang/rust#116292 * rust-lang/rust#116307 * rust-lang/rust#115670 * rust-lang/rust#116225 * rust-lang/rust#116302 * rust-lang/rust#116108 * rust-lang/rust#116160 * rust-lang/rust#116157 * rust-lang/rust#116127 * rust-lang/rust#116286 * rust-lang/rust#116254 * rust-lang/rust#116195 * rust-lang/rust#116280 * rust-lang/rust#115933 * rust-lang/rust#115546 * rust-lang/rust#115368 * rust-lang/rust#116275 * rust-lang/rust#116263 * rust-lang/rust#116241 * rust-lang/rust#116216 * rust-lang/rust#116030 * rust-lang/rust#116024 * rust-lang/rust#112123 * rust-lang/rust#113301 * rust-lang/rust#113797 * rust-lang/rust#115759 * rust-lang/rust#116260 * rust-lang/rust#116253 * rust-lang/rust#116245 * rust-lang/rust#116239 * rust-lang/rust#116234 * rust-lang/rust#116231 * rust-lang/rust#116201 * rust-lang/rust#116133 * rust-lang/rust#116176 * rust-lang/rust#116089 * rust-lang/rust#115986 Co-authored-by: ouz-a <ouz.agz@gmail.com> Co-authored-by: Jakub Beránek <berykubik@gmail.com> Co-authored-by: Federico Stra <stra.federico@gmail.com> Co-authored-by: bohan <bohan-zhang@foxmail.com> Co-authored-by: Jason Newcomb <jsnewcomb@pm.me> Co-authored-by: Ralf Jung <post@ralfj.de> Co-authored-by: bors <bors@rust-lang.org> Co-authored-by: Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
23: Fix divergence from upstream `master` r=tshepang a=pvdrz * rust-lang/rust#116483 * rust-lang/rust#116475 * rust-lang/rust#116329 * rust-lang/rust#116198 * rust-lang/rust#115588 * rust-lang/rust#115522 * rust-lang/rust#115454 * rust-lang/rust#111595 * rust-lang/rust#116018 * rust-lang/rust#116472 * rust-lang/rust#116469 * rust-lang/rust#116421 * rust-lang/rust#116463 * rust-lang/rust#101150 * rust-lang/rust#116269 * rust-lang/rust#116417 * rust-lang/rust#116455 * rust-lang/rust#116452 * rust-lang/rust#116428 * rust-lang/rust#116415 * rust-lang/rust#116288 * rust-lang/rust#116220 * rust-lang/rust#103046 * rust-lang/rust#114042 * rust-lang/rust#104153 * rust-lang/rust#116427 * rust-lang/rust#116443 * rust-lang/rust#116432 * rust-lang/rust#116431 * rust-lang/rust#116429 * rust-lang/rust#116296 * rust-lang/rust#116223 * rust-lang/rust#116273 * rust-lang/rust#116184 * rust-lang/rust#116370 * rust-lang/rust#114417 * rust-lang/rust#115200 * rust-lang/rust#116413 * rust-lang/rust#116381 * rust-lang/rust#116360 * rust-lang/rust#116353 * rust-lang/rust#116406 * rust-lang/rust#116408 * rust-lang/rust#116395 * rust-lang/rust#116393 * rust-lang/rust#116388 * rust-lang/rust#116365 * rust-lang/rust#116363 * rust-lang/rust#116146 * rust-lang/rust#115961 * rust-lang/rust#116386 * rust-lang/rust#116367 * rust-lang/rust#105394 * rust-lang/rust#115301 * rust-lang/rust#116384 * rust-lang/rust#116379 * rust-lang/rust#116328 * rust-lang/rust#116282 * rust-lang/rust#116261 * rust-lang/rust#114654 * rust-lang/rust#116376 * rust-lang/rust#116374 * rust-lang/rust#116371 * rust-lang/rust#116358 * rust-lang/rust#116210 * rust-lang/rust#115863 * rust-lang/rust#115025 * rust-lang/rust#116372 * rust-lang/rust#116361 * rust-lang/rust#116355 * rust-lang/rust#116351 * rust-lang/rust#116158 * rust-lang/rust#115726 * rust-lang/rust#113053 * rust-lang/rust#116083 * rust-lang/rust#102099 * rust-lang/rust#116356 * rust-lang/rust#116350 * rust-lang/rust#116349 * rust-lang/rust#116289 * rust-lang/rust#114454 * rust-lang/rust#114453 * rust-lang/rust#116331 * rust-lang/rust#116346 * rust-lang/rust#116340 * rust-lang/rust#116326 * rust-lang/rust#116313 * rust-lang/rust#116276 * rust-lang/rust#115898 * rust-lang/rust#116325 * rust-lang/rust#116317 * rust-lang/rust#116207 * rust-lang/rust#116281 * rust-lang/rust#116304 * rust-lang/rust#116259 * rust-lang/rust#116228 * rust-lang/rust#116224 * rust-lang/rust#115554 * rust-lang/rust#116311 * rust-lang/rust#116299 * rust-lang/rust#116295 * rust-lang/rust#116292 * rust-lang/rust#116307 * rust-lang/rust#115670 * rust-lang/rust#116225 * rust-lang/rust#116302 * rust-lang/rust#116108 * rust-lang/rust#116160 * rust-lang/rust#116157 * rust-lang/rust#116127 * rust-lang/rust#116286 * rust-lang/rust#116254 * rust-lang/rust#116195 * rust-lang/rust#116280 * rust-lang/rust#115933 * rust-lang/rust#115546 * rust-lang/rust#115368 * rust-lang/rust#116275 * rust-lang/rust#116263 * rust-lang/rust#116241 * rust-lang/rust#116216 * rust-lang/rust#116030 * rust-lang/rust#116024 * rust-lang/rust#112123 * rust-lang/rust#113301 * rust-lang/rust#113797 * rust-lang/rust#115759 * rust-lang/rust#116260 * rust-lang/rust#116253 * rust-lang/rust#116245 * rust-lang/rust#116239 * rust-lang/rust#116234 * rust-lang/rust#116231 * rust-lang/rust#116201 * rust-lang/rust#116133 * rust-lang/rust#116176 * rust-lang/rust#116089 * rust-lang/rust#115986 Co-authored-by: ouz-a <ouz.agz@gmail.com> Co-authored-by: bors <bors@rust-lang.org> Co-authored-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Co-authored-by: linkmauve <linkmauve@linkmauve.fr> Co-authored-by: onur-ozkan <work@onurozkan.dev> Co-authored-by: asquared31415 <34665709+asquared31415@users.noreply.github.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Ralf Jung <post@ralfj.de> Co-authored-by: Nadrieril <nadrieril+git@gmail.com> Co-authored-by: Raekye <Raekye@users.noreply.github.com> Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com> Co-authored-by: Zalathar <Zalathar@users.noreply.github.com>
23: Fix divergence from upstream `master` r=pietroalbini a=pvdrz * rust-lang/rust#116483 * rust-lang/rust#116475 * rust-lang/rust#116329 * rust-lang/rust#116198 * rust-lang/rust#115588 * rust-lang/rust#115522 * rust-lang/rust#115454 * rust-lang/rust#111595 * rust-lang/rust#116018 * rust-lang/rust#116472 * rust-lang/rust#116469 * rust-lang/rust#116421 * rust-lang/rust#116463 * rust-lang/rust#101150 * rust-lang/rust#116269 * rust-lang/rust#116417 * rust-lang/rust#116455 * rust-lang/rust#116452 * rust-lang/rust#116428 * rust-lang/rust#116415 * rust-lang/rust#116288 * rust-lang/rust#116220 * rust-lang/rust#103046 * rust-lang/rust#114042 * rust-lang/rust#104153 * rust-lang/rust#116427 * rust-lang/rust#116443 * rust-lang/rust#116432 * rust-lang/rust#116431 * rust-lang/rust#116429 * rust-lang/rust#116296 * rust-lang/rust#116223 * rust-lang/rust#116273 * rust-lang/rust#116184 * rust-lang/rust#116370 * rust-lang/rust#114417 * rust-lang/rust#115200 * rust-lang/rust#116413 * rust-lang/rust#116381 * rust-lang/rust#116360 * rust-lang/rust#116353 * rust-lang/rust#116406 * rust-lang/rust#116408 * rust-lang/rust#116395 * rust-lang/rust#116393 * rust-lang/rust#116388 * rust-lang/rust#116365 * rust-lang/rust#116363 * rust-lang/rust#116146 * rust-lang/rust#115961 * rust-lang/rust#116386 * rust-lang/rust#116367 * rust-lang/rust#105394 * rust-lang/rust#115301 * rust-lang/rust#116384 * rust-lang/rust#116379 * rust-lang/rust#116328 * rust-lang/rust#116282 * rust-lang/rust#116261 * rust-lang/rust#114654 * rust-lang/rust#116376 * rust-lang/rust#116374 * rust-lang/rust#116371 * rust-lang/rust#116358 * rust-lang/rust#116210 * rust-lang/rust#115863 * rust-lang/rust#115025 * rust-lang/rust#116372 * rust-lang/rust#116361 * rust-lang/rust#116355 * rust-lang/rust#116351 * rust-lang/rust#116158 * rust-lang/rust#115726 * rust-lang/rust#113053 * rust-lang/rust#116083 * rust-lang/rust#102099 * rust-lang/rust#116356 * rust-lang/rust#116350 * rust-lang/rust#116349 * rust-lang/rust#116289 * rust-lang/rust#114454 * rust-lang/rust#114453 * rust-lang/rust#116331 * rust-lang/rust#116346 * rust-lang/rust#116340 * rust-lang/rust#116326 * rust-lang/rust#116313 * rust-lang/rust#116276 * rust-lang/rust#115898 * rust-lang/rust#116325 * rust-lang/rust#116317 * rust-lang/rust#116207 * rust-lang/rust#116281 * rust-lang/rust#116304 * rust-lang/rust#116259 * rust-lang/rust#116228 * rust-lang/rust#116224 * rust-lang/rust#115554 * rust-lang/rust#116311 * rust-lang/rust#116299 * rust-lang/rust#116295 * rust-lang/rust#116292 * rust-lang/rust#116307 * rust-lang/rust#115670 * rust-lang/rust#116225 * rust-lang/rust#116302 * rust-lang/rust#116108 * rust-lang/rust#116160 * rust-lang/rust#116157 * rust-lang/rust#116127 * rust-lang/rust#116286 * rust-lang/rust#116254 * rust-lang/rust#116195 * rust-lang/rust#116280 * rust-lang/rust#115933 * rust-lang/rust#115546 * rust-lang/rust#115368 * rust-lang/rust#116275 * rust-lang/rust#116263 * rust-lang/rust#116241 * rust-lang/rust#116216 * rust-lang/rust#116030 * rust-lang/rust#116024 * rust-lang/rust#112123 * rust-lang/rust#113301 * rust-lang/rust#113797 * rust-lang/rust#115759 * rust-lang/rust#116260 * rust-lang/rust#116253 * rust-lang/rust#116245 * rust-lang/rust#116239 * rust-lang/rust#116234 * rust-lang/rust#116231 * rust-lang/rust#116201 * rust-lang/rust#116133 * rust-lang/rust#116176 * rust-lang/rust#116089 * rust-lang/rust#115986 Co-authored-by: bors <bors@rust-lang.org> Co-authored-by: ouz-a <ouz.agz@gmail.com> Co-authored-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Co-authored-by: linkmauve <linkmauve@linkmauve.fr> Co-authored-by: onur-ozkan <work@onurozkan.dev> Co-authored-by: asquared31415 <34665709+asquared31415@users.noreply.github.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Ralf Jung <post@ralfj.de> Co-authored-by: Nadrieril <nadrieril+git@gmail.com> Co-authored-by: Raekye <Raekye@users.noreply.github.com> Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com> Co-authored-by: Zalathar <Zalathar@users.noreply.github.com>
23: Fix divergence from upstream `master` r=Dajamante a=pvdrz * rust-lang/rust#116483 * rust-lang/rust#116475 * rust-lang/rust#116329 * rust-lang/rust#116198 * rust-lang/rust#115588 * rust-lang/rust#115522 * rust-lang/rust#115454 * rust-lang/rust#111595 * rust-lang/rust#116018 * rust-lang/rust#116472 * rust-lang/rust#116469 * rust-lang/rust#116421 * rust-lang/rust#116463 * rust-lang/rust#101150 * rust-lang/rust#116269 * rust-lang/rust#116417 * rust-lang/rust#116455 * rust-lang/rust#116452 * rust-lang/rust#116428 * rust-lang/rust#116415 * rust-lang/rust#116288 * rust-lang/rust#116220 * rust-lang/rust#103046 * rust-lang/rust#114042 * rust-lang/rust#104153 * rust-lang/rust#116427 * rust-lang/rust#116443 * rust-lang/rust#116432 * rust-lang/rust#116431 * rust-lang/rust#116429 * rust-lang/rust#116296 * rust-lang/rust#116223 * rust-lang/rust#116273 * rust-lang/rust#116184 * rust-lang/rust#116370 * rust-lang/rust#114417 * rust-lang/rust#115200 * rust-lang/rust#116413 * rust-lang/rust#116381 * rust-lang/rust#116360 * rust-lang/rust#116353 * rust-lang/rust#116406 * rust-lang/rust#116408 * rust-lang/rust#116395 * rust-lang/rust#116393 * rust-lang/rust#116388 * rust-lang/rust#116365 * rust-lang/rust#116363 * rust-lang/rust#116146 * rust-lang/rust#115961 * rust-lang/rust#116386 * rust-lang/rust#116367 * rust-lang/rust#105394 * rust-lang/rust#115301 * rust-lang/rust#116384 * rust-lang/rust#116379 * rust-lang/rust#116328 * rust-lang/rust#116282 * rust-lang/rust#116261 * rust-lang/rust#114654 * rust-lang/rust#116376 * rust-lang/rust#116374 * rust-lang/rust#116371 * rust-lang/rust#116358 * rust-lang/rust#116210 * rust-lang/rust#115863 * rust-lang/rust#115025 * rust-lang/rust#116372 * rust-lang/rust#116361 * rust-lang/rust#116355 * rust-lang/rust#116351 * rust-lang/rust#116158 * rust-lang/rust#115726 * rust-lang/rust#113053 * rust-lang/rust#116083 * rust-lang/rust#102099 * rust-lang/rust#116356 * rust-lang/rust#116350 * rust-lang/rust#116349 * rust-lang/rust#116289 * rust-lang/rust#114454 * rust-lang/rust#114453 * rust-lang/rust#116331 * rust-lang/rust#116346 * rust-lang/rust#116340 * rust-lang/rust#116326 * rust-lang/rust#116313 * rust-lang/rust#116276 * rust-lang/rust#115898 * rust-lang/rust#116325 * rust-lang/rust#116317 * rust-lang/rust#116207 * rust-lang/rust#116281 * rust-lang/rust#116304 * rust-lang/rust#116259 * rust-lang/rust#116228 * rust-lang/rust#116224 * rust-lang/rust#115554 * rust-lang/rust#116311 * rust-lang/rust#116299 * rust-lang/rust#116295 * rust-lang/rust#116292 * rust-lang/rust#116307 * rust-lang/rust#115670 * rust-lang/rust#116225 * rust-lang/rust#116302 * rust-lang/rust#116108 * rust-lang/rust#116160 * rust-lang/rust#116157 * rust-lang/rust#116127 * rust-lang/rust#116286 * rust-lang/rust#116254 * rust-lang/rust#116195 * rust-lang/rust#116280 * rust-lang/rust#115933 * rust-lang/rust#115546 * rust-lang/rust#115368 * rust-lang/rust#116275 * rust-lang/rust#116263 * rust-lang/rust#116241 * rust-lang/rust#116216 * rust-lang/rust#116030 * rust-lang/rust#116024 * rust-lang/rust#112123 * rust-lang/rust#113301 * rust-lang/rust#113797 * rust-lang/rust#115759 * rust-lang/rust#116260 * rust-lang/rust#116253 * rust-lang/rust#116245 * rust-lang/rust#116239 * rust-lang/rust#116234 * rust-lang/rust#116231 * rust-lang/rust#116201 * rust-lang/rust#116133 * rust-lang/rust#116176 * rust-lang/rust#116089 * rust-lang/rust#115986 35: Automated pull from `rust-lang/libc` r=pietroalbini a=github-actions[bot] This PR pulls the following changes from the [`rust-lang/libc`](https://github.com/rust-lang/libc) repository: * rust-lang/libc#3335 * rust-lang/libc#3373 * rust-lang/libc#3360 * rust-lang/libc#3374 * rust-lang/libc#3375 * rust-lang/libc#3376 * rust-lang/libc#3377 Co-authored-by: ouz-a <ouz.agz@gmail.com> Co-authored-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Co-authored-by: bors <bors@rust-lang.org> Co-authored-by: linkmauve <linkmauve@linkmauve.fr> Co-authored-by: onur-ozkan <work@onurozkan.dev> Co-authored-by: asquared31415 <34665709+asquared31415@users.noreply.github.com> Co-authored-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Ralf Jung <post@ralfj.de> Co-authored-by: Nadrieril <nadrieril+git@gmail.com> Co-authored-by: Raekye <Raekye@users.noreply.github.com> Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com> Co-authored-by: Zalathar <Zalathar@users.noreply.github.com> Co-authored-by: Nikolay Arhipov <nikolajs.arhipovs@gmail.com> Co-authored-by: Brian Cain <bcain@quicinc.com> Co-authored-by: Steve Lau <stevelauc@outlook.com> Co-authored-by: David CARLIER <devnexen@gmail.com> Co-authored-by: Louis Dupré Bertoni <louisdb@lespetitspedestres.org> Co-authored-by: Taiki Endo <te316e89@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Pkgsrc changes: * Adjust patches and cargo checksums to new versions. * For an external LLVM, set dependency of llvm >= 16, in accordance with the upstream changes. * Mark that on NetBSD we now need >= 9.0, so 8.x is no longer supported. * On NetBSD/sparc64 10.x, we now need GCC 12 to build the embedded LLVM, which is version 17; apparently GCC 10.4 or 10.5 mis-compiles it, resulting in an illegal instruction fault during the build. Ref. rust-lang/rust#117231 Upstream changes: Version 1.75.0 (2023-12-28) ========================== - [Stabilize `async fn` and return-position `impl Trait` in traits.] (rust-lang/rust#115822) - [Allow function pointer signatures containing `&mut T` in `const` contexts.] (rust-lang/rust#116015) - [Match `usize`/`isize` exhaustively with half-open ranges.] (rust-lang/rust#116692) - [Guarantee that `char` has the same size and alignment as `u32`.] (rust-lang/rust#116894) - [Document that the null pointer has the 0 address.] (rust-lang/rust#116988) - [Allow partially moved values in `match`.] (rust-lang/rust#103208) - [Add notes about non-compliant FP behavior on 32bit x86 targets.] (rust-lang/rust#113053) - [Stabilize ratified RISC-V target features.] (rust-lang/rust#116485) Compiler -------- - [Rework negative coherence to properly consider impls that only partly overlap.] (rust-lang/rust#112875) - [Bump `COINDUCTIVE_OVERLAP_IN_COHERENCE` to deny, and warn in dependencies.] (rust-lang/rust#116493) - [Consider alias bounds when computing liveness in NLL.] (rust-lang/rust#116733) - [Add the V (vector) extension to the `riscv64-linux-android` target spec.] (rust-lang/rust#116618) - [Automatically enable cross-crate inlining for small functions] (rust-lang/rust#116505) - Add several new tier 3 targets: - [`csky-unknown-linux-gnuabiv2hf`] (rust-lang/rust#117049) - [`i586-unknown-netbsd`] (rust-lang/rust#117170) - [`mipsel-unknown-netbsd`] (rust-lang/rust#117356) Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support. Libraries --------- - [Override `Waker::clone_from` to avoid cloning `Waker`s unnecessarily.] (rust-lang/rust#96979) - [Implement `BufRead` for `VecDeque<u8>`.] (rust-lang/rust#110604) - [Implement `FusedIterator` for `DecodeUtf16` when the inner iterator does.] (rust-lang/rust#110729) - [Implement `Not, Bit{And,Or}{,Assign}` for IP addresses.] (rust-lang/rust#113747) - [Implement `Default` for `ExitCode`.] (rust-lang/rust#114589) - [Guarantee representation of None in NPO] (rust-lang/rust#115333) - [Document when atomic loads are guaranteed read-only.] (rust-lang/rust#115577) - [Broaden the consequences of recursive TLS initialization.] (rust-lang/rust#116172) - [Windows: Support sub-millisecond sleep.] (rust-lang/rust#116461) - [Fix generic bound of `str::SplitInclusive`'s `DoubleEndedIterator` impl] (rust-lang/rust#100806) - [Fix exit status / wait status on non-Unix `cfg(unix)` platforms.] (rust-lang/rust#115108) Stabilized APIs --------------- - [`Atomic*::from_ptr`] (https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr) - [`FileTimes`] (https://doc.rust-lang.org/stable/std/fs/struct.FileTimes.html) - [`FileTimesExt`] (https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTimesExt.html) - [`File::set_modified`] (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_modified) - [`File::set_times`] (https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_times) - [`IpAddr::to_canonical`] (https://doc.rust-lang.org/stable/core/net/enum.IpAddr.html#method.to_canonical) - [`Ipv6Addr::to_canonical`] (https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_canonical) - [`Option::as_slice`] (https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_slice) - [`Option::as_mut_slice`] (https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut_slice) - [`pointer::byte_add`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_add) - [`pointer::byte_offset`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset) - [`pointer::byte_offset_from`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset_from) - [`pointer::byte_sub`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_sub) - [`pointer::wrapping_byte_add`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_add) - [`pointer::wrapping_byte_offset`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_offset) - [`pointer::wrapping_byte_sub`] (https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_sub) These APIs are now stable in const contexts: - [`Ipv6Addr::to_ipv4_mapped`] (https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_ipv4_mapped) - [`MaybeUninit::assume_init_read`] (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_read) - [`MaybeUninit::zeroed`] (https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.zeroed) - [`mem::discriminant`] (https://doc.rust-lang.org/stable/core/mem/fn.discriminant.html) - [`mem::zeroed`] (https://doc.rust-lang.org/stable/core/mem/fn.zeroed.html) Cargo ----- - [Add new packages to `[workspace.members]` automatically.] (rust-lang/cargo#12779) - [Allow version-less `Cargo.toml` manifests.] (rust-lang/cargo#12786) - [Make browser links out of HTML file paths.] (rust-lang/cargo#12889) Rustdoc ------- - [Accept less invalid Rust in rustdoc.] (rust-lang/rust#117450) - [Document lack of object safety on affected traits.] (rust-lang/rust#113241) - [Hide `#[repr(transparent)]` if it isn't part of the public ABI.] (rust-lang/rust#115439) - [Show enum discriminant if it is a C-like variant.] (rust-lang/rust#116142) Compatibility Notes ------------------- - [FreeBSD targets now require at least version 12.] (rust-lang/rust#114521) - [Formally demote tier 2 MIPS targets to tier 3.] (rust-lang/rust#115238) - [Make misalignment a hard error in `const` contexts.] (rust-lang/rust#115524) - [Fix detecting references to packed unsized fields.] (rust-lang/rust#115583) - [Remove support for compiler plugins.] (rust-lang/rust#116412)
Based on ton of prior discussion (see all the issues linked from rust-lang/unsafe-code-guidelines#237), the consensus seems to be that these targets are simply cursed and we cannot implement the desired semantics for them. I hope I properly understood what exactly the extent of the curse is here, let's make sure people with more in-depth FP knowledge take a close look!
In particular for the tier 3 targets I have no clue which target is affected by which particular variant of the x86_32 FP curse. I assumed that
i686
meant SSE is used so the "floating point return value" is the only problem, while everything lower (i586
,i386
) meant x87 is used.I opened #114479 to concisely describe and track the issue.
Cc @workingjubilee @thomcc @chorman0773 @rust-lang/opsem
Fixes #73288
Fixes #72327