On Wed, 8 Oct 2025, Peter Damianov via Mingw-w64-public wrote:
Remove incorrect width adjustment that prevented proper padding
with spaces for %g format specifier when the value has trailing
zeros in the integer part.
The original code would reduce the field width when precision
became negative (e.g., for 100000.0, precision = strlen("1") - 6 = -5),
causing the output to lose its padding:
printf("(%10g)\n", 100000.0f); // was: (100000), expected: ( 100000)
The fix clamps negative precision to 0 instead of adjusting the
width, preserving the requested field width for proper padding.
Adds test case t_printf_g_width.
ref: https://github.com/skeeto/w64devkit/issues/269
Signed-off-by: Peter Damianov <[email protected]>
---
v3: Fix the bug properly
add newline at end of testcase
don't regenerate any autogenerated files
mingw-w64-crt/stdio/mingw_pformat.c | 11 +++--------
mingw-w64-crt/testcases/t_printf_g_width.c | 18 ++++++++++++++++++
2 files changed, 21 insertions(+), 8 deletions(-)
create mode 100644 mingw-w64-crt/testcases/t_printf_g_width.c
Did this patch lose the update of Makefile.am, for the new testcase?
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public