public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Fix gcc 9 build errors for make xcheck. [BZ #24556]
@ 2019-06-19 10:33 Stefan Liebler
0 siblings, 0 replies; only message in thread
From: Stefan Liebler @ 2019-06-19 10:33 UTC (permalink / raw)
To: glibc-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 5564 bytes --]
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10
commit f0c5a803bdefd15079d23db4ac5c3b9ba1cc2f10
Author: Stefan Liebler <stli@linux.ibm.com>
Date: Wed Jun 19 12:32:04 2019 +0200
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.
Diff:
---
ChangeLog | 11 +++++++++++
argp/argp-test.c | 2 +-
benchtests/bench-malloc-simple.c | 2 +-
benchtests/bench-strstr.c | 3 ++-
nss/tst-field.c | 3 ++-
string/test-strcasestr.c | 3 ++-
string/test-strstr.c | 3 ++-
7 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f32b734..48d59d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2019-06-19 Stefan Liebler <stli@linux.ibm.com>
+
+ [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.
+
2019-06-19 Florian Weimer <fweimer@redhat.com>
[BZ #24166]
diff --git a/argp/argp-test.c b/argp/argp-test.c
index cb2976d..13e0c6d 100644
--- a/argp/argp-test.c
+++ b/argp/argp-test.c
@@ -123,7 +123,7 @@ static const char doc[] = "Test program for argp."
static void
popt (int key, char *arg)
{
- char buf[10];
+ char buf[12];
if (isprint (key))
sprintf (buf, "%c", key);
else
diff --git a/benchtests/bench-malloc-simple.c b/benchtests/bench-malloc-simple.c
index b8bb2cc..c4f06f6 100644
--- a/benchtests/bench-malloc-simple.c
+++ b/benchtests/bench-malloc-simple.c
@@ -87,7 +87,7 @@ bench (unsigned long size)
size_t iters = NUM_ITERS;
int **arr = (int**) malloc (MAX_ALLOCS * sizeof (void*));
- for (int t = 0; t <= 3; t++)
+ for (int t = 0; t < 3; t++)
for (int i = 0; i < NUM_ALLOCS; i++)
{
tests[t][i].n = allocs[i];
diff --git a/benchtests/bench-strstr.c b/benchtests/bench-strstr.c
index 2cbe13e..89d1755 100644
--- a/benchtests/bench-strstr.c
+++ b/benchtests/bench-strstr.c
@@ -147,7 +147,8 @@ do_one_test (impl_t *impl, const char *s1, const char *s2, char *exp_result)
if (res != exp_result)
{
error (0, 0, "Wrong result in function %s %s %s", impl->name,
- res, exp_result);
+ (res == NULL) ? "(null)" : res,
+ (exp_result == NULL) ? "(null)" : exp_result);
ret = 1;
}
}
diff --git a/nss/tst-field.c b/nss/tst-field.c
index 23d2f2a..d98d3ee 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);
diff --git a/string/test-strcasestr.c b/string/test-strcasestr.c
index 0a16f85..7649cc6 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 031aff5..df6dbc2 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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-06-19 10:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-19 10:33 [glibc] Fix gcc 9 build errors for make xcheck. [BZ #24556] Stefan Liebler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).