[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/7] xen/arm: Make make_cpus_node() compile at -Og



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.cooper3@xxxxxxxxxx>
---
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien@xxxxxxx>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
---
  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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.