target/arm/m_helper: Silence GCC 10 maybe-uninitialized error
commit0ae4f11ee57350dac0e705ba79516310400ff43c
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Tue, 19 Jan 2021 06:27:39 +0000 (19 07:27 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 19 Jan 2021 15:45:14 +0000 (19 15:45 +0000)
tree86aac5f474716122f292ce44f8d31114d1b575a1
parent73624e04a5381c3046109e4d4ec796e66b9dbd95
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é <f4bug@amsat.org>
Message-id: 20210119062739.589049-1-f4bug@amsat.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/m_helper.c