[CRIU] zdtm test build failure on s390x (s390x_regs_check.c)
Michael Holzheu
holzheu at linux.vnet.ibm.com
Tue Sep 5 20:47:26 MSK 2017
On Tue, 5 Sep 2017 17:56:08 +0200
Adrian Reber <adrian at lisas.de> wrote:
> When running 'make zdtm' on s390x it fails on my RHEL kernel with:
>
> make[3]: Leaving directory `/tmp/criu/test/zdtm/lib'
> CC s390x_regs_check.o
> s390x_regs_check.c: In function ‘util_hexdump_grp’:
> s390x_regs_check.c:214:7: error: ‘ptr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> ptr += sprintf(ptr, "%02x", buf[i]);
> ^
Obviously the compiler does not understand the "if (first)" construct.
I assume the following will fix the problem:
---
[CRIU][PATCH] zdtm/s390x_regs_check: Fix compiler warning
When running 'make zdtm' on s390x it fails on RHEL7 with:
make[3]: Leaving directory `/tmp/criu/test/zdtm/lib'
CC s390x_regs_check.o
s390x_regs_check.c: In function "util_hexdump_grp":
s390x_regs_check.c:214:7: error: "ptr" may be used uninitialized
in this function [-Werror=maybe-uninitialized]
ptr += sprintf(ptr, "%02x", buf[i]);
Fix this and assign ptr from the beginning to help gcc.
Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
---
test/zdtm/static/s390x_regs_check.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/zdtm/static/s390x_regs_check.c b/test/zdtm/static/s390x_regs_check.c
index a92679a..1a7e841 100644
--- a/test/zdtm/static/s390x_regs_check.c
+++ b/test/zdtm/static/s390x_regs_check.c
@@ -198,8 +198,8 @@ struct reg_set *reg_set_vec[] = {
void util_hexdump_grp(const char *tag, const void *data, int grp,
int count, int indent)
{
+ char str[1024], *ptr = str;
const char *buf = data;
- char str[1024], *ptr;
int i, first = 1;
for (i = 0; i < count; i++) {
--
2.7.4
More information about the CRIU
mailing list