fix(libc): preserve acoshf domain errno and exception flags #10610
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10610"
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 JJenkx on 2026-10-24T12:39:26Z.
What
Follow-up to merged #10003. The existing
acoshfdomain branch returns the measured NaN bits, but leaves errno unchanged and relies on arithmetic that raises invalid only in SSE. In both supplied bundled copies, that same domain branch sets EDOM and raises invalid in SSE and x87; negative quiet NaNs also raise invalid although NaN arithmetic alone need not do so.Call the existing
_Feraise_nid_postfix(0x01)and seterrno = EDOMin that branch, retaining its return expression and all numerical range handling. Positive NaNs/infinity keep their existing separate path. Add a 576-call regression (12 cases × four rounding modes × four DAZ/FTZ combinations × three sticky seeds), including payloads and positive non-domain controls; update the older errno expectation. This introduces no new export or runtime dependency.The separately observed finite directed-rounding result-bit differences remain recorded in debt. This change does not claim to correct them.
Tested
Current-main refresh:
02d48b3bc394375bb5d10d81c5875599f90cd14b, two linear topic commits directly on maine7e3e9c1984c293f06bff08428b8c89b7b932ac2. Removed obsolete local declarations now supplied by the public API, including_Feraise; the complete acoshf implementation and both regression functions are preserved.Fresh Linux Release: rebuilt libc and the three math test targets.
guest_math,guest_math_exact,guest_dinkumware_internalsandpublic_headerseach pass three repeats. A production-only main-Math control fails the new domain check on +0; exact-math/Dinkumware controls pass. Restored candidate passes all four groups three times and restores a byte-identical libc. Conventions and whitespace checks pass. These are current-head regression checks; the earlier reference-copy matrix below retains its original pins. No new Windows/title or performance result is claimed.Current-head logs, negative/restoration checks, pins and patch, SHA-256
f91e8735d1f1eef09bf2917dec7a301927312611d6ac544d205c94689a4d8e91.Arch Linux 7.2.9, GCC 16.2.1 Release, Ryzen 9 7950X, x86-64 masked exceptions. Earlier matrix qualification: main
b930da950d5d076c19d8e6a025805f3799cadbc5, candidate2620b766049ef97e96cd8ee45c35c488035e4475.guest_math,guest_math_exact,guest_dinkumware_internalstargets build; all three test groups pass. Same-test main control93229fd1192cde4ed804743e642aa4d90aa8770afails specifically atacoshf domain:on +0: errno stays 1234 and x87 invalid is absent; the other two groups pass.0x40000002/0x40000003under directed rounding; they are explicitly excluded from the correction and retained in the artifact/debt. The comparison is sampled, not exhaustive.GuestMath.cpptocore/libs/tests/runtime/GuestMath.cpp, so this regression must be preserved at the moved path if that layout lands first. Adjacent math and additive debt/test insertions remain separate topics.Reproduction probes, matrices, exact patches, build/test logs and code hashes, SHA256
d3231a3793d42173812c49b2db5c2074c67d90c6ac0016310b4c5c7abc24b5c1. No SDK binaries, code bytes or game assets are included.Independent exact-head check: MarcZX10 reports a Release CMake build with GCC 12.2 and all three focused groups (
guest_math,guest_math_exact,guest_dinkumware_internals) passing 3/3 at2620b766049ef97e96cd8ee45c35c488035e4475. This is the reporter's focused build/test result; it does not claim a full application build or reproduce the supplied-module matrix.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:45:09Z.
Review: APPROVED
Reviewed exact head
2620b766049ef97e96cd8ee45c35c488035e4475. The change preserves the existing result expression and numerical path while explicitly settingEDOMand raisingFE_INVALIDonly in the invalid-domain branch; the positive NaN/infinity path remains separate. The new regression checks signed zero, below-domain finite values, negative infinity and negative NaNs across all four rounding modes, DAZ/FTZ combinations, and pre-existing sticky flags; positive boundary/NaN/infinity cases guard the unaffected path. The PR reports targeted Linux libc tests and comparisons against both supplied binaries; I did not reproduce those locally. Hosted eligibility, conventions, intake, labels, report, the Ubuntu/Windows/macOS relinker matrix, ASan, register-context and write-watch checks pass. Hosted Linux and Windows product builds are skipped by the eligibility gate. I found no blocking issue in this diff.