From: "Philippe Mathieu-Daudé" <philippe.mathieu.daude@gmail.com>
To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: "Eduardo Habkost" <eduardo@habkost.net>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [RFC PATCH-for-7.0] hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12
Date: Fri, 18 Mar 2022 15:03:41 +0100 [thread overview]
Message-ID: <2a8a7a37-57c1-9f6d-3a2d-359b8060abfb@gmail.com> (raw)
In-Reply-To: <20220318004153.4510-1-philippe.mathieu.daude@gmail.com>
+qemu-trivial@
On 18/3/22 01:41, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Initialize 'oldlevel' early to avoid on Debian/sid:
>
> FAILED: libqemu-x86_64-softmmu.fa.p/hw_i386_amd_iommu.c.o
> In function 'pte_get_page_mask',
> inlined from 'amdvi_page_walk' at hw/i386/amd_iommu.c:945:25,
> inlined from 'amdvi_do_translate' at hw/i386/amd_iommu.c:989:5,
> inlined from 'amdvi_translate' at hw/i386/amd_iommu.c:1038:5:
> hw/i386/amd_iommu.c:877:38: error: 'oldlevel' may be used uninitialized [-Werror=maybe-uninitialized]
> 877 | return ~((1UL << ((oldlevel * 9) + 3)) - 1);
> | ~~~~~~~~~~~~~~~~^~~~
> hw/i386/amd_iommu.c: In function 'amdvi_translate':
> hw/i386/amd_iommu.c:906:41: note: 'oldlevel' was declared here
> 906 | unsigned level, present, pte_perms, oldlevel;
> | ^~~~~~~~
> cc1: all warnings being treated as errors
>
> Having:
>
> $ gcc --version
> gcc (Debian 12-20220313-1) 12.0.1 20220314 (experimental)
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/i386/amd_iommu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
> index 4d13d8e697..b6d299f964 100644
> --- a/hw/i386/amd_iommu.c
> +++ b/hw/i386/amd_iommu.c
> @@ -904,6 +904,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte,
> /* make sure the DTE has TV = 1 */
> if (pte & AMDVI_DEV_TRANSLATION_VALID) {
> level = get_pte_translation_mode(pte);
> + oldlevel = level;
> if (level >= 7) {
> trace_amdvi_mode_invalid(level, addr);
> return;
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philippe.mathieu.daude@gmail.com>
To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org
Cc: "Eduardo Habkost" <eduardo@habkost.net>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [RFC PATCH-for-7.0] hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12
Date: Fri, 18 Mar 2022 15:03:41 +0100 [thread overview]
Message-ID: <2a8a7a37-57c1-9f6d-3a2d-359b8060abfb@gmail.com> (raw)
In-Reply-To: <20220318004153.4510-1-philippe.mathieu.daude@gmail.com>
+qemu-trivial@
On 18/3/22 01:41, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Initialize 'oldlevel' early to avoid on Debian/sid:
>
> FAILED: libqemu-x86_64-softmmu.fa.p/hw_i386_amd_iommu.c.o
> In function 'pte_get_page_mask',
> inlined from 'amdvi_page_walk' at hw/i386/amd_iommu.c:945:25,
> inlined from 'amdvi_do_translate' at hw/i386/amd_iommu.c:989:5,
> inlined from 'amdvi_translate' at hw/i386/amd_iommu.c:1038:5:
> hw/i386/amd_iommu.c:877:38: error: 'oldlevel' may be used uninitialized [-Werror=maybe-uninitialized]
> 877 | return ~((1UL << ((oldlevel * 9) + 3)) - 1);
> | ~~~~~~~~~~~~~~~~^~~~
> hw/i386/amd_iommu.c: In function 'amdvi_translate':
> hw/i386/amd_iommu.c:906:41: note: 'oldlevel' was declared here
> 906 | unsigned level, present, pte_perms, oldlevel;
> | ^~~~~~~~
> cc1: all warnings being treated as errors
>
> Having:
>
> $ gcc --version
> gcc (Debian 12-20220313-1) 12.0.1 20220314 (experimental)
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/i386/amd_iommu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
> index 4d13d8e697..b6d299f964 100644
> --- a/hw/i386/amd_iommu.c
> +++ b/hw/i386/amd_iommu.c
> @@ -904,6 +904,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte,
> /* make sure the DTE has TV = 1 */
> if (pte & AMDVI_DEV_TRANSLATION_VALID) {
> level = get_pte_translation_mode(pte);
> + oldlevel = level;
> if (level >= 7) {
> trace_amdvi_mode_invalid(level, addr);
> return;
next prev parent reply other threads:[~2022-03-18 14:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 0:41 [RFC PATCH-for-7.0] hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12 Philippe Mathieu-Daudé
2022-03-18 14:03 ` Philippe Mathieu-Daudé [this message]
2022-03-18 14:03 ` Philippe Mathieu-Daudé
2022-03-21 14:40 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a8a7a37-57c1-9f6d-3a2d-359b8060abfb@gmail.com \
--to=philippe.mathieu.daude@gmail.com \
--cc=eduardo@habkost.net \
--cc=f4bug@amsat.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.