Hi Andrew,

On 19/04/2021 15:01, Andrew Cooper wrote:
When compiling at -Og:

   domain_build.c: In function 'make_cpus_node':
   domain_build.c:926:12: error: 'clock_valid' may be used uninitialized in 
this function [-Werror=maybe-uninitialized]
     926 |         if ( clock_valid )
         |            ^

The compiler hasn't spotted that clock_valid is always initialised after the
"if ( !compatible )" check.  Initialise clock_valid to false.

Can you confirm which version this is affecting? We bumped the minimum version of GCC recently, so I want to make sure we don't add code to silence older compilers.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Stefano Stabellini <sstabell...@kernel.org>
CC: Julien Grall <jul...@xen.org>
CC: Volodymyr Babchuk <volodymyr_babc...@epam.com>
---
  xen/arch/arm/domain_build.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b1d7b9849f..b10f5c8f85 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -831,7 +831,7 @@ static int __init make_cpus_node(const struct domain *d, 
void *fdt)
      /* Placeholder for cpu@ + a 32-bit hexadecimal number + \0 */
      char buf[13];
      u32 clock_frequency;
-    bool clock_valid;
+    bool clock_valid = false;

Would you mind to add something like:

/* Initialized silence at least GCC X.Y. */

With X.Y replaced with the version.

Cheers,

--
Julien Grall

Reply via email to