[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen master] target/arm: Avoid maybe-uninitialized warning with gcc 4.9



commit 88a90e3de6ae99cbcfcc04c862c51f241fdf685f
Author:     Kaige Li <likaige@xxxxxxxxxxx>
AuthorDate: Mon Aug 3 17:55:04 2020 +0100
Commit:     Peter Maydell <peter.maydell@xxxxxxxxxx>
CommitDate: Mon Aug 3 17:55:04 2020 +0100

    target/arm: Avoid maybe-uninitialized warning with gcc 4.9
    
    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@xxxxxxxxxxx>
    Message-id: 1596110248-7366-2-git-send-email-likaige@xxxxxxxxxxx
    Reviewed-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
    [PMM: Clean up commit message and note which gcc version this was]
    Signed-off-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
---
 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 8c0764957c..c98dfb17a8 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);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.