* [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error
@ 2021-01-17 17:04 Philippe Mathieu-Daudé
2021-01-17 18:02 ` Paolo Bonzini
2021-01-18 7:26 ` Thomas Huth
0 siblings, 2 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-17 17:04 UTC (permalink / raw
To: qemu-devel
Cc: Paolo Bonzini, Thomas Huth, Alex Bennée,
Philippe Mathieu-Daudé, Peter Maydell
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.
Supersedes: <20210117160754.4086411-1-f4bug@amsat.org>
---
softmmu/physmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 6301f4f0a5c..cdcd197656f 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -605,7 +605,7 @@ static void tcg_register_iommu_notifier(CPUState *cpu,
* when the IOMMU tells us the mappings we've cached have changed.
*/
MemoryRegion *mr = MEMORY_REGION(iommu_mr);
- TCGIOMMUNotifier *notifier;
+ TCGIOMMUNotifier *notifier = NULL;
int i;
for (i = 0; i < cpu->iommu_notifiers->len; i++) {
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error
2021-01-17 17:04 [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error Philippe Mathieu-Daudé
@ 2021-01-17 18:02 ` Paolo Bonzini
2021-01-18 7:26 ` Thomas Huth
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2021-01-17 18:02 UTC (permalink / raw
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Peter Maydell, Thomas Huth, Alex Bennée
On 17/01/21 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.
>
> Supersedes: <20210117160754.4086411-1-f4bug@amsat.org>
> ---
> softmmu/physmem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/softmmu/physmem.c b/softmmu/physmem.c
> index 6301f4f0a5c..cdcd197656f 100644
> --- a/softmmu/physmem.c
> +++ b/softmmu/physmem.c
> @@ -605,7 +605,7 @@ static void tcg_register_iommu_notifier(CPUState *cpu,
> * when the IOMMU tells us the mappings we've cached have changed.
> */
> MemoryRegion *mr = MEMORY_REGION(iommu_mr);
> - TCGIOMMUNotifier *notifier;
> + TCGIOMMUNotifier *notifier = NULL;
> int i;
>
> for (i = 0; i < cpu->iommu_notifiers->len; i++) {
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error
2021-01-17 17:04 [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error Philippe Mathieu-Daudé
2021-01-17 18:02 ` Paolo Bonzini
@ 2021-01-18 7:26 ` Thomas Huth
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2021-01-18 7:26 UTC (permalink / raw
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Alex Bennée, Peter Maydell
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-18 7:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-17 17:04 [PATCH v2] softmmu/physmem: Silence GCC 10 maybe-uninitialized error Philippe Mathieu-Daudé
2021-01-17 18:02 ` Paolo Bonzini
2021-01-18 7:26 ` Thomas Huth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.