PVS-StudioWarnings

PVS-Studio warning V501 for Clang

Nov 20th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. bool DAGCombiner::SimplifySelectOps(....) {
  2.   ...
  3.   LoadSDNode *LLD = cast<LoadSDNode>(LHS);
  4.   LoadSDNode *RLD = cast<LoadSDNode>(RHS);
  5.   ...
  6.   if ((LLD->hasAnyUseOfValue(1) &&
  7.        (LLD->isPredecessorOf(CondLHS) ||
  8.         LLD->isPredecessorOf(CondRHS))) ||
  9.       (LLD->hasAnyUseOfValue(1) &&
  10.        (LLD->isPredecessorOf(CondLHS) ||
  11.         LLD->isPredecessorOf(CondRHS))))
  12.     return false;
  13.   ...
  14. }
  15.  
  16. A Copy-Paste error. The programmer seems to have forgotten to replace LLD with RLD in three places.
  17.  
  18. This suspicious code was found in Clang project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V501 There are identical sub-expressions to the left and to the right of the '||' operator. LLVMSelectionDAG dagcombiner.cpp 7340
  21.  
  22. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment