Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for Clang

Nov 27th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. static GenericValue executeFCMP_UNO(GenericValue Src1,
  2.                                     GenericValue Src2,
  3.                                     Type *Ty) {
  4.   GenericValue Dest;
  5.   if (Ty->isFloatTy())
  6.     Dest.IntVal = APInt(1,(Src1.FloatVal != Src1.FloatVal ||
  7.                            Src2.FloatVal != Src2.FloatVal));
  8.   else
  9.     Dest.IntVal = APInt(1,(Src1.DoubleVal != Src1.DoubleVal ||
  10.                            Src2.DoubleVal != Src2.DoubleVal));
  11.   return Dest;
  12. }
  13.  
  14. This suspicious code was found in Clang project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V501 There are identical sub-expressions to the left and to the right of the '!=' operator: Src1.FloatVal != Src1.FloatVal LLVMInterpreter execution.cpp 437
  17.  
  18. 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
Advertisement