#23 linux-atm-2.5.1/src/lane/ldb.c:89: possible bad if test ?

None
accepted
nobody
None
5
2013-10-25
2013-10-23
dcb
No

I just compiled linux-atm-2.5.1 with extra compiler flag -Wlogical-op

It said

ldb.c:89:3: warning: logical 'or' of collectively exhaustive tests is always true [-Wlogical-op]

Source code is

return ((test >= '0' && test <= '9') || (test >= 'a' || test <= 'f') ||
(test >= 'A' && test <= 'F') || test == 'x' || test == 'X');

This bit looks wrong

(test >= 'a' || test <= 'f')

Suggest swap || for &&.

Discussion

  • chas williams
    chas williams
    2013-10-25

    That does appear to be the correct fix. I will merge it and produce a new release (eventually).

     
  • chas williams
    chas williams
    2013-10-25

    • status: open --> accepted
    • Group: -->