From: Philippe Mathieu-Daudé Date: Tue, 19 Jan 2021 06:27:39 +0000 (+0100) Subject: target/arm/m_helper: Silence GCC 10 maybe-uninitialized error X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0ae4f11ee57350dac0e705ba79516310400ff43c;p=qemu.git target/arm/m_helper: Silence GCC 10 maybe-uninitialized error 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é Message-id: 20210119062739.589049-1-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c index 6176003029..731c435c00 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