On 07/30/2020 04:44 PM, Peter Maydell wrote:

On Thu, 30 Jul 2020 at 02:56, Kaige Li <lika...@loongson.cn> wrote:
When I compile qemu with such as:

git clone https://git.qemu.org/git/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure
make

There is error log:

/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;
                       ^
cc1: all warnings being treated as errors

So, add an initiallization value for fn to fix this.

Signed-off-by: Kaige Li <lika...@loongson.cn>
What compiler version is this ?
It's the latest version: v5.1.0-rc2, but VERSION shows that is 5.0.92.
Commit id is 5772f2b1fc5d00e7e04e01fa28e9081d6550440a

---
  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 8c07649..910a91f 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 = tcg_gen_atomic_fetch_add_i64;
NULL would be a better choice for a "this is never actually used"
initialiser.
Ok, I will have a try and submit it in v2.

Thank you.
Kaige.

thanks
-- PMM


Reply via email to