qemu-ppc
[Top][All Lists]
Advanced

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

Re: [RFC PATCH] target/ppc/mmu: Silent maybe-uninitialized error in ppc_


From: Thomas Huth
Subject: Re: [RFC PATCH] target/ppc/mmu: Silent maybe-uninitialized error in ppc_hash64_xlate()
Date: Mon, 26 Feb 2024 08:43:40 +0100
User-agent: Mozilla Thunderbird

On 23/02/2024 09.32, Philippe Mathieu-Daudé wrote:
Initialize apshift to avoid a maybe-uninitialized error:

   C compiler for the host machine: cc -m64 -mbig-endian (gcc 13.2.0 "cc (Debian 
13.2.0-10) 13.2.0")
   C linker for the host machine: cc -m64 -mbig-endian ld.bfd 2.41.90.20240115
   Host machine cpu family: ppc64
   Host machine cpu: ppc64
   ...
   target/ppc/mmu-hash64.c: In function 'ppc_hash64_xlate':
   target/ppc/mmu-hash64.c:1154:15: error: 'apshift' may be used uninitialized 
[-Werror=maybe-uninitialized]
    1154 |     *raddrp = deposit64(pte.pte1 & HPTE64_R_RPN, 0, apshift, eaddr);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   target/ppc/mmu-hash64.c:947:14: note: 'apshift' was declared here
     947 |     unsigned apshift;
         |              ^~~~~~~

The call chain is:

   ppc_hash64_xlate -> ppc_hash64_htab_lookup -> ppc_hash64_pteg_search

ppc_hash64_pteg_search() either sets *pshift or returns -1,

ppc_hash64_htab_lookup() returns if ppc_hash64_pteg_search()
returned -1:

   1068:    ptex = ppc_hash64_htab_lookup(cpu, slb, eaddr, &pte, &apshift);
   1069:    if (ptex == -1) {
   1070:        if (!guest_visible) {
   1071:            return false;
   1072:        }
                ...
   1087:        return false;

So IIUC this "uninitialized use" can not happens.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
I had this in an old branch (2 months old) I just rebased,
and don't get why nobody else got this error yet.

That's weird, indeed. Did you maybe compile without optimizations when you hit the error?

 Thomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]