fix(libc): fmod leaves errno unchanged #3600
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3600"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by CouchRiv on 2026-10-11T14:07:46Z.
What
fmod(1.0, 0.0)sets errno to 33 onmain. FreeBSD msun reports math errors through floating-point exceptions only and never sets errno (math.h#L67-L69), so a caller that checks errno afterfmodsees a stale error onmain.fmodnow saves errno before the host call and restores it after; the result and the floating-point flags do not change.Tested
CachyOS Linux, RTX 4070 Ti (NVIDIA) and Radeon 610M (RADV), lavapipe for CI parity.
fmod_nid_postfixchecks fail onmainand pass with the change; 1/1 on NVIDIA, RADV and lavapipe.tools/check_conventions.py --base origin/mainandgit diff --check: clean.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:20:13Z.
Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.tools/check_conventions.py --base origin/mainpasses.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T22:10:40Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/tests/GuestMath.cppL178, L618-619