Repository navigation
fix(libc): count wide collate string elements - #6517
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.
|
|
I checked the size and capacity rules against the VC12 source you link. Your negative control relinked a separate copy of Setup: head
Source check (xstring at your pinned revision): Overlap: this PR merges cleanly with #6087, which also changes Not checked: Windows and macOS, and PS5 hardware. I compared against the VC12 source only, not a console Written with AI assistance (Claude Code). I ran the builds and tests above on my machine. AI-assisted: yes |
What
Fix the string result returned by the existing
collate<wchar_t>transform. Foru"abc", main writessize=6, capacity=14into inline storage. Under the Dinkumware string layout already modeled byGuestLocale::String, a 16-bit string stores element counts: its inline capacity is 7, and capacity 14 selects heap storage, interpreting those inline characters as a pointer.Record size/capacity in 16-bit elements and allocate
(capacity + 1) * 2bytes for heap results. Keep the existing allocation/alignment helper. This follows VC12 xstring at a fixed revision and addresses the string-layout question raised in the review of #5662. The implementation of_Getcatfrom that merged PR is retained.The existing tests now expect element counts and the correct allocation size at 7/8 characters. Added 2039/2040-character cases check the transition to the existing 4096-byte aligned allocation, the stored base pointer, contents and terminator. Hash, comparison and embedded-NUL behavior remain covered by the existing tests.
Tested
BUILD_TESTING=ON: full build passed, including the incremental build after rebasing to the base below.guest_collateand nine neighbouring locale/wide-string tests passed three times each (30 runs, no skips).libsand the same ten test targets built; all ten CTests passed three times each (30 runs, no skips).libc.prxusing the base branch'sLocaleSupport.cppand the same remaining objects. This PR'sguest_collateaborts against that copy and passes against the corrected library. No production source or build artifact was replaced for this check.GpuIndirectArgumentsMisalignedWriterAhead.cpp:25: MinGW rejectsalignas(65536)because the object format's maximum is 8192. Compiling the base branch's identical file separately reproduces the same error. The library build and relevant tests above pass.python tools/check_conventions.py --base origin/mainandgit diff --checkpass. Scanned the filenames of 608 open PRs, including pagination for PRs with over 100 files: none changes this wide-transform implementation. feat(libc): export locale::classic (PPSA34015) #6087 addslocale::classicin another region of the same source file.Based on
main03c4cb5e7; the three changed files are unchanged since the original full-build basefa9365ca7. No console or title run; the wide string ABI is derived from the existing Dinkumware model and the source above. Full upstream Linux/Windows CI requires a maintainer's manual dispatch.Checklist
main; no other open PR implements the same correction