From f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10 Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Wed, 19 Jun 2019 12:32:04 +0200 Subject: Fix gcc 9 build errors for make xcheck. [BZ #24556] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes the following gcc 9 warnings for "make xcheck" / "make bench": -string/tst-strcasestr.c: ../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=] -argp/argp-test.c: argp-test.c:130:20: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=] argp-test.c:130:19: note: directive argument in the range [-2147483648, 122] argp-test.c:130:5: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10 -nss/tst-field.c: tst-field.c:52:7: error: ‘%s’ directive argument is null [-Werror=format-overflow=] -benchtests/bench-strstr.c: ../include/bits/../../misc/bits/error.h:42:5: error: ‘%s’ directive argument is null [-Werror=format-overflow=] -benchtests/bench-malloc-simple.c: bench-malloc-simple.c:93:16: error: iteration 3 invokes undefined behavior [-Werror=aggressive-loop-optimizations] ChangeLog: [BZ #24556] * string/test-strcasestr.c (check_result): Add NULL check. * nss/tst-field.c (check_rewrite): Likewise. * benchtests/bench-strstr.c (do_one_test): Likewise. * string/test-strstr.c (check_result): Likewise. * argp/argp-test.c (popt): Increase size of buf to 12. * benchtests/bench-malloc-simple.c (bench): Do not initialize tests array out of bounds. --- nss/tst-field.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nss') diff --git a/nss/tst-field.c b/nss/tst-field.c index 23d2f2abf6..d98d3eead0 100644 --- a/nss/tst-field.c +++ b/nss/tst-field.c @@ -50,7 +50,8 @@ check_rewrite (const char *input, const char *expected) if (result != NULL && strcmp (result, expected) != 0) { printf ("FAIL: rewrite \"%s\" -> \"%s\", expected \"%s\"\n", - input, result, expected); + (input == NULL) ? "(null)" : input, result, + (expected == NULL) ? "(null)" : expected); errors = true; } free (to_free); -- cgit 1.4.1