aboutsummaryrefslogtreecommitdiff
path: root/string
diff options
context:
space:
mode:
authorStefan Liebler <stli@linux.ibm.com>2019-06-19 12:32:04 +0200
committerStefan Liebler <stli@linux.ibm.com>2019-06-19 12:32:04 +0200
commitf0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10 (patch)
treea6d1b406e45af713d9ac363d912b28c7a253e19d /string
parentfabf5e49ddd61312027de8e92cc1b8528c2a929d (diff)
downloadglibc-f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10.tar
glibc-f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10.tar.gz
glibc-f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10.tar.bz2
glibc-f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10.zip
Fix gcc 9 build errors for make xcheck. [BZ #24556]
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.
Diffstat (limited to 'string')
-rw-r--r--string/test-strcasestr.c3
-rw-r--r--string/test-strstr.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/string/test-strcasestr.c b/string/test-strcasestr.c
index 0a16f85dcd..7649cc6e1d 100644
--- a/string/test-strcasestr.c
+++ b/string/test-strcasestr.c
@@ -67,7 +67,8 @@ check_result (impl_t *impl, const char *s1, const char *s2,
if (result != exp_result)
{
error (0, 0, "Wrong result in function %s %s %s", impl->name,
- result, exp_result);
+ (result == NULL) ? "(null)" : result,
+ (exp_result == NULL) ? "(null)" : exp_result);
ret = 1;
return -1;
}
diff --git a/string/test-strstr.c b/string/test-strstr.c
index 031aff5534..df6dbc251e 100644
--- a/string/test-strstr.c
+++ b/string/test-strstr.c
@@ -66,7 +66,8 @@ check_result (impl_t *impl, const char *s1, const char *s2,
if (result != exp_result)
{
error (0, 0, "Wrong result in function %s %s %s", impl->name,
- result, exp_result);
+ (result == NULL) ? "(null)" : result,
+ (exp_result == NULL) ? "(null)" : exp_result);
ret = 1;
return -1;
}