Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: src



Module Name:    src
Committed By:   riastradh
Date:           Thu May  9 12:24:24 UTC 2024

Modified Files:
        src/lib/libc/gdtoa: hdtoa.c
        src/tests/lib/libc/stdio: t_printf.c

Log Message:
Revert various broken changes to printf %La (hldtoa).

This reverts:

hdtoa.c 1.12 (PR/56247: Greg A. Woods: printf("%La", LDBL_MIN) dumps core)
hdtoa.c 1.11 (fix tyop)
hdtoa.c 1.10 (Via enh at google dot com in tech-userlevel. Fix handling of
    EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).)

The underlying motivation for this change was that when ld128 is
decomposed into 4x32 words, this hldtoa logic is broken.

But we don't decompose ld128 into 4x32 words; we decompose it into
6x64 words.

And the change, which was supposed to be a noop in our case of 2x64
words (or similar for x87 80-bit floating-point), broke it to the
point of causing buffer overruns (PR 56247) which when worked around
led to just incorrect output output (PR 56937).

If we want to make the #ifdefs for 4x32 words work, that's fine, but
we absolutely must have automatic test cases to detect this kind of
regression because %La formatting is extremely important for
diagnosing details of floating-point data since it doesn't involve
rounding in binary formats.  For now I've added some trivial tests;
there is a more extensive test suite inside gdtoa that we need to
wire up before anyone tries any other shenanigans in this code.

PR lib/56937: printf(3) long double %a formatting is broken


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/gdtoa/hdtoa.c
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libc/stdio/t_printf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index