Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing parentheses in several expressions #5

Closed
karel-brinda opened this issue Feb 7, 2016 · 4 comments
Closed

Missing parentheses in several expressions #5

karel-brinda opened this issue Feb 7, 2016 · 4 comments

Comments

@karel-brinda
Copy link

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
Copy link
Member

rchikhi commented Feb 9, 2016

Bonjour Karel,

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

@pgdurand
Copy link
Member

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
Copy link
Author

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
Copy link
Member

rchikhi commented Feb 17, 2016

i patched those that you reported, thank you

@rchikhi rchikhi closed this as completed Feb 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants