qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs


From: G 3
Subject: Re: [Qemu-devel] [Qemu-ppc] Floating point unit bugs
Date: Tue, 9 May 2017 09:58:56 -0400


On May 9, 2017, at 5:55 AM, BALATON Zoltan wrote:

On Tue, 9 May 2017, Aurelien Jarno wrote:
| main.c: In function 'print_fpscr_settings':
| main.c:73:26: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
|          if ((fpscr >> i) & 0x1 == 1) {
|                           ^

Actually the compiler is correct here, this should be:

if ((fpscr >> i & 0x1) == 1) {

or even just

if (fpscr >> i & 1) {

because & is lower priority than == but the result may still be the same by chance if 0x1 == 1 is always 1 and ANDing the shifted value with this is either 0 or 1 so it may give the correct result but not the way one would think looking at the expression.

I changed it to this:
if (((fpscr >> i) & 0x1) == 1)

Thank you.



reply via email to

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