PVS-StudioWarnings

PVS-Studio warning V595 for Clang

Nov 11th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. Instruction *InstCombiner::visitGetElementPtrInst(
  2.                              GetElementPtrInst &GEP) {
  3.   ...
  4.   Value *StrippedPtr = PtrOp->stripPointerCasts();
  5.   PointerType *StrippedPtrTy =
  6.     dyn_cast<PointerType>(StrippedPtr->getType());
  7.  
  8.   if (!StrippedPtr)
  9.     return 0;
  10.   ...
  11. }
  12.  
  13. This suspicious code was found in Clang project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V595 The 'StrippedPtr' pointer was utilized before it was verified against nullptr. Check lines: 918, 920. LLVMInstCombine instructioncombining.cpp 918
  16.  
  17. 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