qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error


From: Thomas Huth
Subject: Re: [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error
Date: Mon, 18 Jan 2021 08:26:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 17/01/2021 18.04, Philippe Mathieu-Daudé wrote:
When building with GCC 10.2 configured with --extra-cflags=-Os, we get:

   softmmu/physmem.c: In function ‘address_space_translate_for_iotlb’:
   softmmu/physmem.c:643:26: error: ‘notifier’ may be used uninitialized in 
this function [-Werror=maybe-uninitialized]
     643 |         notifier->active = true;
         |                          ^
   softmmu/physmem.c:608:23: note: ‘notifier’ was declared here
     608 |     TCGIOMMUNotifier *notifier;
         |                       ^~~~~~~~

Initialize 'notifier' to silence the warning.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2: Remove pointless assert (Peter Maydell)

Yet another hole in our CI.


I wouldn't call this a hole in the CI. AFAIU we don't support compiling with anything else than the default -O2 (and maybe -O0 for debugging?). -O3 is known to produce a lot of compiler warnings, and apparently -Os has such "problems", too. As far as I can see, it's a false positive warning here, "notifier" should always get initialized, the compiler just fails to see it correctly. Anyway, initializing the variable also can not hurt, so:

Reviewed-by: Thomas Huth <thuth@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]