Hi John,

On 05/09/2017 10:58 AM, G 3 wrote:

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.

do you think you can add your test as a qtest, to run it with check-qtest?

Regards,

Phil.



Reply via email to