* [PATCH] target/arm/m_helper: Silence GCC 10 maybe-uninitialized error
@ 2021-01-19 6:27 Philippe Mathieu-Daudé
2021-01-19 13:53 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-19 6:27 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Peter Maydell, qemu-arm, Philippe Mathieu-Daudé
When building with GCC 10.2 configured with --extra-cflags=-Os, we get:
target/arm/m_helper.c: In function ‘arm_v7m_cpu_do_interrupt’:
target/arm/m_helper.c:1811:16: error: ‘restore_s16_s31’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
1811 | if (restore_s16_s31) {
| ^
target/arm/m_helper.c:1350:10: note: ‘restore_s16_s31’ was declared here
1350 | bool restore_s16_s31;
| ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Initialize the 'restore_s16_s31' variable to silence the warning.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/arm/m_helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
index 61760030292..731c435c00b 100644
--- a/target/arm/m_helper.c
+++ b/target/arm/m_helper.c
@@ -1347,7 +1347,7 @@ static void do_v7m_exception_exit(ARMCPU *cpu)
bool exc_secure = false;
bool return_to_secure;
bool ftype;
- bool restore_s16_s31;
+ bool restore_s16_s31 = false;
/*
* If we're not in Handler mode then jumps to magic exception-exit
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] target/arm/m_helper: Silence GCC 10 maybe-uninitialized error
2021-01-19 6:27 [PATCH] target/arm/m_helper: Silence GCC 10 maybe-uninitialized error Philippe Mathieu-Daudé
@ 2021-01-19 13:53 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2021-01-19 13:53 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: QEMU Trivial, qemu-arm, QEMU Developers
On Tue, 19 Jan 2021 at 06:27, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> When building with GCC 10.2 configured with --extra-cflags=-Os, we get:
>
> target/arm/m_helper.c: In function ‘arm_v7m_cpu_do_interrupt’:
> target/arm/m_helper.c:1811:16: error: ‘restore_s16_s31’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 1811 | if (restore_s16_s31) {
> | ^
> target/arm/m_helper.c:1350:10: note: ‘restore_s16_s31’ was declared here
> 1350 | bool restore_s16_s31;
> | ^~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
>
> Initialize the 'restore_s16_s31' variable to silence the warning.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/arm/m_helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-19 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 6:27 [PATCH] target/arm/m_helper: Silence GCC 10 maybe-uninitialized error Philippe Mathieu-Daudé
2021-01-19 13:53 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).