https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98384
--- Comment #38 from Rainer Orth <ro at gcc dot gnu.org> ---
Prompted by the the fact that the Solaris workaround in PR107815 is no longer
needed, I've rechecked this bug, too:
The test now fails with
20_util/to_chars/long_double.cc:213: void test02(): Assertion
'!memcmp(printf_buffer, to_chars_buffer, output_length)' failed.
On Solaris, I get this for precision = 10000 and printf_specifier = "%.*Lf":
(gdb) p printf_buffer
$1 = "1.", '0' <repeats 10000 times>...
(gdb) p to_chars_buffer
$2 = "1.", '0' <repeats 10000 times>...
(gdb) p output_length
$3 = 10006
while Linux shows
(gdb) p printf_buffer
$11 = "1.", '0' <repeats 10000 times>
(gdb) p to_chars_buffer
$12 = "1.", '0' <repeats 10000 times>
gdb) p output_length
$10 = 10002
However, the equivalent minimal
#include <cstdio>
int
main (void)
{
int n = snprintf (nullptr, 0, "%.*Lf", 10000, 1, 1.0L);
printf ("n = %d\n", n);
return 0;
}
print 10002 on both Solaris and Linux...