PVS-StudioWarnings

PVS-Studio warning V501 for Clang

Nov 19th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. static SDValue PerformSELECTCombine(....)
  2. {
  3.   ...
  4.   SDValue LHS = N->getOperand(1);
  5.   SDValue RHS = N->getOperand(2);
  6.  
  7.   ...
  8.   if (!UnsafeFPMath &&
  9.       !DAG.isKnownNeverZero(LHS) &&
  10.       !DAG.isKnownNeverZero(RHS))
  11.   ...
  12.   if (!UnsafeFPMath &&
  13.       !DAG.isKnownNeverZero(LHS) &&
  14.       !DAG.isKnownNeverZero(LHS))
  15.   ...
  16. }
  17.  
  18. Maybe RHS should be used in the last line, not LHS.
  19.  
  20. This suspicious code was found in Clang project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V501 There are identical sub-expressions '!DAG.isKnownNeverZero (LHS)' to the left and to the right of the '&&' operator. LLVMX86CodeGen x86isellowering.cpp 11635
  23.  
  24. 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