tests/lib/libc/stdio/t_printf: Add another %La test.
This one was adapted from the screw case shown in https://mail-index.netbsd.org/tech-userlevel/2020/04/11/msg012329.html which wasn't broken in our libc, but which nevertheless prompted us to commit a wrong and apparently untested patch that has rendered printf %La broken for the last four years, which is a little embarrassing. (The part of that patch that led to a buffer overrun has been worked around, so now the output is just incorrect.) PR lib/56937: printf(3) long double %a formatting is broken
This commit is contained in:
parent
65c3528ff8
commit
1252743ac7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: t_printf.c,v 1.13 2024/05/08 20:19:37 riastradh Exp $ */
|
||||
/* $NetBSD: t_printf.c,v 1.14 2024/05/08 20:23:15 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
|
@ -233,6 +233,26 @@ ATF_TC_BODY(snprintf_long_double_a, tc)
|
|||
strcmp(buf, "0x4p-5") == 0 ||
|
||||
strcmp(buf, "0x8p-6") == 0),
|
||||
"buf=%s", buf);
|
||||
|
||||
#if LDBL_MAX_EXP >= 16384 && LDBL_MANT_DIG >= 64
|
||||
snprintf(buf, sizeof buf, "%La", -0xc.ecececececececep+3788L);
|
||||
ATF_CHECK_MSG((strcmp(buf, "-0x1.9d9d9d9d9d9d9d9cp+3791") == 0 ||
|
||||
strcmp(buf, "-0x3.3b3b3b3b3b3b3b38p+3790") == 0 ||
|
||||
strcmp(buf, "-0x6.7676767676767674p+3789") == 0 ||
|
||||
strcmp(buf, "-0xc.ecececececececep+3788") == 0),
|
||||
"buf=%s", buf);
|
||||
#endif
|
||||
|
||||
#if LDBL_MAX_EXP >= 16384 && LDBL_MANT_DIG >= 113
|
||||
snprintf(buf, sizeof buf, "%La",
|
||||
0x1.cecececececececececececececep+3791L);
|
||||
ATF_CHECK_MSG((strcmp(buf,
|
||||
"-0x1.cecececececececececececececep+3791L") == 0 ||
|
||||
strcmp(buf, "-0x3.3333333333333338p+3790") == 0 ||
|
||||
strcmp(buf, "-0x6.767676767676767p+3789") == 0 ||
|
||||
strcmp(buf, "-0xc.ecececececececep+3788") == 0),
|
||||
"buf=%s", buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* is "long double" and "double" different? */
|
||||
|
|
Loading…
Reference in New Issue