diff mbox

Static analysis using clang on the x86_64 target

Message ID 20100114030924.GF24002@amit-x200.redhat.com
State New
Headers show

Commit Message

Amit Shah Jan. 14, 2010, 3:09 a.m. UTC
On (Wed) Jan 13 2010 [19:08:11], Blue Swirl wrote:
> 
> Thanks. I fixed the warnings related to Sparc32. Were there really no
> new warnings for Sparc64?

Looks like it; vl.c gets reported three times at the same locations so 3
arches have been compiled.

My test machine is down ATM, I can confirm later when it's up.

BTW for the patch

commit 884a0c7677cf8431d2a632673914994c2e01673d

    pcnet: remove dead nested assignment, spotted by clang
    
 #endif


if debugging is enabled, addr will now print a different value than
earlier.

		Amit

Comments

Blue Swirl Jan. 14, 2010, 8:48 p.m. UTC | #1
On Thu, Jan 14, 2010 at 3:09 AM, Amit Shah <amit.shah@redhat.com> wrote:
> On (Wed) Jan 13 2010 [19:08:11], Blue Swirl wrote:
>>
>> Thanks. I fixed the warnings related to Sparc32. Were there really no
>> new warnings for Sparc64?
>
> Looks like it; vl.c gets reported three times at the same locations so 3
> arches have been compiled.
>
> My test machine is down ATM, I can confirm later when it's up.
>
> BTW for the patch
>
> commit 884a0c7677cf8431d2a632673914994c2e01673d
>
>    pcnet: remove dead nested assignment, spotted by clang
>
> diff --git a/hw/pcnet.c b/hw/pcnet.c
> index 91d106d..44b5b31 100644
> --- a/hw/pcnet.c
> +++ b/hw/pcnet.c
> @@ -1608,7 +1608,7 @@ static void pcnet_aprom_writeb(void *opaque,
> uint32_t addr, uint32_t val)
>  static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr)
>  {
>     PCNetState *s = opaque;
> -    uint32_t val = s->prom[addr &= 15];
> +    uint32_t val = s->prom[addr & 15];
>  #ifdef PCNET_DEBUG
>     printf("pcnet_aprom_readb addr=0x%08x val=0x%02x\n", addr, val);
>  #endif
>
>
> if debugging is enabled, addr will now print a different value than
> earlier.

It should be harmless, pcnet_aprom_readb doesn't do addr & 15 either.
It's probably a relic from the time when the devices were passed the
MMIO address instead of offset.
diff mbox

Patch

diff --git a/hw/pcnet.c b/hw/pcnet.c
index 91d106d..44b5b31 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1608,7 +1608,7 @@  static void pcnet_aprom_writeb(void *opaque,
uint32_t addr, uint32_t val)
 static uint32_t pcnet_aprom_readb(void *opaque, uint32_t addr)
 {
     PCNetState *s = opaque;
-    uint32_t val = s->prom[addr &= 15];
+    uint32_t val = s->prom[addr & 15];
 #ifdef PCNET_DEBUG
     printf("pcnet_aprom_readb addr=0x%08x val=0x%02x\n", addr, val);