[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 6/8] target/arm: Avoid maybe-uninitialized warning with gcc 4.9
From: |
Peter Maydell |
Subject: |
[PULL 6/8] target/arm: Avoid maybe-uninitialized warning with gcc 4.9 |
Date: |
Mon, 3 Aug 2020 20:33:57 +0100 |
From: Kaige Li <likaige@loongson.cn>
GCC version 4.9.4 isn't clever enough to figure out that all
execution paths in disas_ldst() that use 'fn' will have initialized
it first, and so it warns:
/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
/home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
^
/home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared
here
AtomicThreeOpFn *fn;
^
Make it happy by initializing the variable to NULL.
Signed-off-by: Kaige Li <likaige@loongson.cn>
Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: Clean up commit message and note which gcc version this was]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/translate-a64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 8c0764957c8..c98dfb17a83 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -3315,7 +3315,7 @@ static void disas_ldst_atomic(DisasContext *s, uint32_t
insn,
bool r = extract32(insn, 22, 1);
bool a = extract32(insn, 23, 1);
TCGv_i64 tcg_rs, clean_addr;
- AtomicThreeOpFn *fn;
+ AtomicThreeOpFn *fn = NULL;
if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
unallocated_encoding(s);
--
2.20.1
- [PULL 0/8] target-arm queue, Peter Maydell, 2020/08/03
- [PULL 1/8] hw/arm/netduino2, netduinoplus2: Set system_clock_scale, Peter Maydell, 2020/08/03
- [PULL 2/8] include/hw/irq.h: New function qemu_irq_is_connected(), Peter Maydell, 2020/08/03
- [PULL 3/8] hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ, Peter Maydell, 2020/08/03
- [PULL 4/8] msf2-soc, stellaris: Don't wire up SYSRESETREQ, Peter Maydell, 2020/08/03
- [PULL 5/8] target/arm: Fix AddPAC error indication, Peter Maydell, 2020/08/03
- [PULL 6/8] target/arm: Avoid maybe-uninitialized warning with gcc 4.9,
Peter Maydell <=
- [PULL 7/8] hw/arm/nrf51_soc: Set system_clock_scale, Peter Maydell, 2020/08/03
- [PULL 8/8] hw/timer/imx_epit: Avoid assertion when CR.SWR is written, Peter Maydell, 2020/08/03
- Re: [PULL 0/8] target-arm queue, Peter Maydell, 2020/08/03