Advertisement
PVS-StudioWarnings

PVS-Studio warning V595 for Clang

Nov 21st, 2014
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. void LSRInstance::ChainInstruction(....)
  2. {
  3.   ...
  4.   Instruction *OtherUse = dyn_cast<Instruction>(*UseIter);
  5.   if (SE.isSCEVable(OtherUse->getType())
  6.       && !isa<SCEVUnknown>(SE.getSCEV(OtherUse))
  7.       && IU.isIVUserOrOperand(OtherUse)) {
  8.     continue;
  9.   }
  10.   if (OtherUse && OtherUse != UserInst)
  11.     NearUsers.insert(OtherUse);
  12.   ...
  13. }
  14.  
  15. This suspicious code was found in Clang project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V595 The 'OtherUse' pointer was utilized before it was verified against nullptr. Check lines: 2522, 2527. LLVMScalarOpts loopstrengthreduce.cpp 2522
  18.  
  19. 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