[libvirt] [PATCH] examples: Initialize @pos in domtop.c

Martin Kletzander mkletzan at redhat.com
Mon Apr 15 09:30:54 UTC 2019


This is a zero-cost workaround for a bug in GCC 8.3.0 which causes the
compilation to fail, because the compiler thinks that the value might be used
uninitialized even though it clearly cannot be.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
This is technically a fix for a build-breaker, but I'm sending it for review as
it is not that big of a deal it being in examples/

 examples/domtop/domtop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c
index c9b51aed510d..e463e2873f42 100644
--- a/examples/domtop/domtop.c
+++ b/examples/domtop/domtop.c
@@ -206,7 +206,7 @@ print_cpu_usage(size_t cpu,
     }
 
     for (i = 0; i < ncpus; i++) {
-        size_t pos;
+        size_t pos = 0;
         double usage;
 
         /* check if the vCPU is in the maps */
-- 
2.21.0




More information about the libvir-list mailing list