Repository navigation
fix(libc): preserve zero in alternate wide octal formatting - #8440
Merged
oneandonlydean merged 1 commit intoOct 20, 2026
Merged
Conversation
|
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wide formatting now preserves the zero digit for alternate-form octal output with precision zero:
swprintf(..., u"%#.0o", 0u)produces0instead of an empty string. The shared wide formatter applies the same normalization already present in the narrow formatter, after narrowingh/hharguments and before host formatting.The reference is FreeBSD 11.4 vfwprintf.c, number conversion, which retains zero for alternate octal even when precision is zero. This is source-based compatibility work; it was not measured on a PS5.
Related #5293 and #5303 address additional conversions. This change covers the residual alternate-octal case, does not close the broader issue, and merges cleanly with the current #5303 head in a local merge-tree check. That combination was not executed.
Tested
Windows, WinLibs GCC 15.2.0 UCRT, Release, based on main
02b5a8e55.guest_wide_formattingaborts atswprintf alternate octal zero.guest_wide_formatting,guest_formatting, all threeguest_standard_streamsmodes andfile_streamspass (6/6).swprintf,vswprintf,snwprintf_s, empty/zero precision, field width, alignment, zero padding, dynamic and positional precision,h/hhnarrowing, long long, bounded output, and unaffected hexadecimal/unflagged/nonzero cases.python tools/check_conventions.py --base upstream/mainandgit diff --checkpass. Linux and a console/title run were not performed.tools/pr_overlap.pyreported only an uncomparable shared test file in test: organize library tests and label CTest suites #6044; manual inspection shows it is a pure rename totests/runtime/GuestWideFormatting.cpp(zero additions/deletions), with no duplicate logic.Checklist
main; no other open PR implements the same functions (no duplicate alternate-octal fix found; related fix(libc): follow measured wide printf behavior #5303 changes other cases in the shared wide formatter)NotImplemented_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)