GATB / gatb-core

Core library of the Genome Analysis Toolbox with de-Bruijn graph
https://gatb.inria.fr/software/gatb-core/
63 stars 27 forks source link

Missing parentheses in several expressions #5

Closed karel-brinda closed 8 years ago

karel-brinda commented 8 years ago

Hello,

when I compile gatb-core with clang, several potential errors are reported. I think that they are real errors. See this log:

In file included from /Users/karel/github/metang/proc/main.cpp:1:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/gatb_core.hpp:40:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/collections/impl/Bloom.hpp:33:
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt.hpp:842:21: warning: & has lower
      precedence than ==; == will be evaluated first [-Wparentheses]
            if (val & 15 == 0) // val starts with AA
                    ^~~~~~~~~
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt.hpp:842:21: note: place parentheses
      around the '==' expression to silence this warning
            if (val & 15 == 0) // val starts with AA
                    ^
                      (      )
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt.hpp:842:21: note: place parentheses
      around the & expression to evaluate it first
            if (val & 15 == 0) // val starts with AA
                    ^
                (       )
In file included from /Users/karel/github/metang/proc/main.cpp:1:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/gatb_core.hpp:40:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/collections/impl/Bloom.hpp:33:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt.hpp:855:
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt1.pri:300:17: warning: & has lower
      precedence than ==; == will be evaluated first [-Wparentheses]
        if (val & 15 == 0) // val starts with AA
                ^~~~~~~~~
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt1.pri:300:17: note: place parentheses
      around the '==' expression to silence this warning
        if (val & 15 == 0) // val starts with AA
                ^
                  (      )
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt1.pri:300:17: note: place parentheses
      around the & expression to evaluate it first
        if (val & 15 == 0) // val starts with AA
                ^
            (       )
In file included from /Users/karel/github/metang/proc/main.cpp:1:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/gatb_core.hpp:40:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/collections/impl/Bloom.hpp:33:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt.hpp:860:
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt2.pri:272:21: warning: & has lower
      precedence than ==; == will be evaluated first [-Wparentheses]
            if (val & 15 == 0) // val starts with AA
                    ^~~~~~~~~
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt2.pri:272:21: note: place parentheses
      around the '==' expression to silence this warning
            if (val & 15 == 0) // val starts with AA
                    ^
                      (      )
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/tools/math/LargeInt2.pri:272:21: note: place parentheses
      around the & expression to evaluate it first
            if (val & 15 == 0) // val starts with AA
                    ^
                (       )
In file included from /Users/karel/github/metang/proc/main.cpp:1:
In file included from /Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/gatb_core.hpp:78:
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/debruijn/impl/Graph.hpp:1183:30: warning: & has lower
      precedence than ==; == will be evaluated first [-Wparentheses]
            if ((value >> 1) & 1 == 1) 
                             ^~~~~~~~
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/debruijn/impl/Graph.hpp:1183:30: note: place parentheses
      around the '==' expression to silence this warning
            if ((value >> 1) & 1 == 1) 
                             ^
                               (     )
/Users/karel/github/metang/proc/contrib/gatbcore-install/include/gatb/debruijn/impl/Graph.hpp:1183:30: note: place parentheses
      around the & expression to evaluate it first
            if ((value >> 1) & 1 == 1) 
                             ^
                (               )
4 warnings generated.
rchikhi commented 8 years ago

Bonjour Karel,

Thanks for bringing this to our attention. You're right, this can likely be bug source. We'll fix this asap.

pgdurand commented 8 years ago

Hi Karel,

since my Mac system (Yosemite ; clang-700.0.72) does not report these warnings, could you please let me know what is your configuration ? Just provide me with the output of "clang --version".

karel-brinda commented 8 years ago
On-y-go:~ karel$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
rchikhi commented 8 years ago

i patched those that you reported, thank you