On 4/16/23 22:03, Stewart Hildebrand wrote:
> On 4/16/23 08:53, Julien Grall wrote:
>> Hi Stewart,
> 
> Hi Julien,
> 
>> On 14/04/2023 19:57, Stewart Hildebrand wrote:
>>> When building the hypervisor with -Og, we encounter the following error:
>>
>> Is this with GCC 12 as well?
> 
> Yes. If my memory serves me correctly this particular one occurs with both 
> GCC 11 and 12.
> 
>>> arch/arm/domain_build.c: In function ‘make_cpus_node’:
>>> arch/arm/domain_build.c:2040:12: error: ‘clock_valid’ may be used 
>>> uninitialized [-Werror=maybe-uninitialized]
>>>   2040 |         if ( clock_valid )
>>>        |            ^
>>> arch/arm/domain_build.c:1947:10: note: ‘clock_valid’ was declared here
>>>   1947 |     bool clock_valid;
>>>        |          ^~~~~~~~~~~
>>> cc1: all warnings being treated as errors
>>>
>>> Fix it by initializing the variable.
>>>
>>> Signed-off-by: Stewart Hildebrand <[email protected]>
>>> ---
>>> See previous discussion here
>>> https://lists.xenproject.org/archives/html/xen-devel/2022-10/msg00741.html
>>> ---
>>>   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 4f9d4f9d8867..18b350734a8e 100644
>>> --- a/xen/arch/arm/domain_build.c
>>> +++ b/xen/arch/arm/domain_build.c
>>> @@ -1944,7 +1944,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;
>>
>> NIT: I would add "Keep the compiler happy with -Og"
>>
>> I am happy to add it while committing if you agree.
> 
> Yes, please do. Thanks.

One more thing, there is a typo in the subject, if you are willing to correct 
it while committing. s/unitialized/uninitialized/

>> Reviewed-by: Julien Grall <[email protected]>
>>
>> Cheers,
>>
>> --
>> Julien Grall
> 

Reply via email to