Repository navigation
fix(libc): preserve errno across fmodf domain errors - #9643
Conversation
|
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.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Data on the console behaviour this models, from the
So on the console I'm not touching those paths. Separately I'm porting the |
jotitadev
left a comment
There was a problem hiding this comment.
Linux run, since the description lists Linux behavior as untested: the updated guest_math is red on main and green with the PR on glibc.
Machine: Linux, Ubuntu 26.04, GCC 15.2.0 (glibc host libm), x86-64, i7-8700. Head bd769c3c3 merged with git merge --no-commit onto current main d6eafa54d. Full build, BUILD_TESTING=ON, ANYPS5_RELINKER_ONLY=OFF, Ninja Release; the whole build passes.
- PR test with
main'sMath.cpp:guest_mathaborts on the first new case:Guest acosf failed for 3f800001: got ffc00000, expected ffc00000, invalid 0, errno 73, the same missing invalid flag and untouched sentinel errno described for Windows. - PR:
guest_mathandguest_floating_pointpass (2/2).
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
The Linux run independently confirms the test goes red on main and green with this PR for the missing |
|
A data point from @JJenkx on #9668 that narrows what I wrote above: with |
bd769c3 to
43c4203
Compare
|
I rechecked the updated head On this Linux host, I compiled and ran a UBSan-enabled focused harness using the new wrapper and the PR's |
|
While reviewing #9771, I compared the current heads. Its |
|
@Noxy-HNR I maintain #9771 ( |
43c4203 to
7b839b0
Compare
|
Rebased onto main b7d1d47. #9771 edits the line next to |
7b839b0 to
ee057ea
Compare
|
I’ve noticed that asking you to hold this PR was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. |
What
Preserve errno around
fmodf, as the existing double-precisionfmodwrapper does. The original Windows library changes sentinel errno 73 to EDOM 33 forfmodf(1, 0), leaking the host CRT's policy into this model.FreeBSD 11.4's C implementation returns the invalid-operation NaN without an errno store. Its selected amd64 assembly implementation likewise has no errno store. The wrapper continues to use the host remainder result and flags; console errno, flags and NaN payloads remain unmeasured and are recorded in debt.
Tested
Windows 11 26H2 (build 10.0.26300), WinLibs GCC 15.2.0 r7, full Release build, head ee057ea on main d6e7ab4.
guest_mathandguest_floating_pointpass, 2/2.FE_INVALIDand preservation of an existing exception, and restores the prior floating-point environment and errno. Against main'sfmodfit fails with errno 73 changed to EDOM 33.core/libs/prx/libc/src/Math.cppnext tofmodf. Either landing order gives one conflict hunk there, resolved by keeping both functions; the tests anddocs/dev/debt/libc.mdmerge cleanly. That combination built and passedguest_mathandguest_floating_point, 2/2, and the #9771 author confirmed either order is fine.tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass.tools/pr_overlap.pyand merge tests against the 103 open pull requests that touch these files find no conflict other than fix(libc): compute asinf with FreeBSD msun's algorithm, as titles' libc.prx does #9771.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)