Failing to build test-cpu-policy.c with GCC9
Hey, Andy,
openSUSE Tumbleweed has: gcc version 9.1.1 20190703
And this fails to build test-cpu-policy.c, like this:
test-cpu-policy.c: In function ‘main’:
test-cpu-policy.c:64:18: error: ‘%.12s’ directive argument is not a nul-terminated string [-Werror=format-overflow=]
64 | fail(" Test '%.12s', expected vendor %u, got %u\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test-cpu-policy.c:20:12: note: in definition of macro ‘fail’
20 | printf(fmt, ##__VA_ARGS__); \
| ^~~
test-cpu-policy.c:64:27: note: format string is defined here
64 | fail(" Test '%.12s', expected vendor %u, got %u\n",
| ^~~~~
test-cpu-policy.c:44:7: note: referenced argument declared here
44 | } tests[] = {
| Even just doing something like below, seems to fix it for me, but there probably are better ways...
Regards
---
tools/tests/cpu-policy/test-cpu-policy.c +1 -1
@@ -35,7 +35,7 @@ static void test_vendor_identification(void) { static const struct test { union { - char ident[12]; + char ident[13]; struct { uint32_t b, d, c; };
Signature · 6 lines
Dario Faggioli, Ph.D http://about.me/dario.faggioli Virtualization Software Engineer SUSE Labs, SUSE https://www.suse.com/ ------------------------------------------------------------------- <<This happens because _I_ choose it to happen!>> (Raistlin Majere)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 17 lines · Dario Faggioli
Hey, Andy,
openSUSE Tumbleweed has: gcc version 9.1.1 20190703
And this fails to build
test-cpu-policy.c, like this:
test-cpu-policy.c: In function ‘main’:
test-cpu-policy.c:64:18: error: ‘%.12s’ directive argument is not a nul-terminated string [-Werror=format-overflow=]
64 | fail(" Test '%.12s', expected vendor %u, got %u\n",| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~test-cpu-policy.c:20:12: note: in definition of macro ‘fail’
20 |printf(fmt, ##__VA_ARGS__); \
| ^~~
test-cpu-policy.c:64:27: note: format string is defined here
64 | fail(" Test '%.12s', expected vendor %u, got %u\n",
| ^~~~~
test-cpu-policy.c:44:7: note: referenced argument declared here
Quoted 5 lines
44 | } tests[] = { |Even just doing something like below, seems to fix it for me, but there probably are better ways...
It's a compiler bug, but I haven't had time to file a ticket yet.
The claim in the warning is false.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel