PVS-StudioWarnings

PVS-Studio warning V612 for Clang

Nov 20th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. bool
  2. ObjCARCOpt::VisitBottomUp(....) {
  3.   ...
  4.   for (BBState::edge_iterator SI(MyStates.succ_begin()),
  5.        SE(MyStates.succ_end()); SI != SE; ++SI)
  6.   {
  7.     const BasicBlock *Succ = *SI;
  8.     DenseMap<const BasicBlock *, BBState>::iterator I =
  9.       BBStates.find(Succ);
  10.     assert(I != BBStates.end());
  11.     MyStates.InitFromSucc(I->second);
  12.     ++SI;
  13.     for (; SI != SE; ++SI) {
  14.       Succ = *SI;
  15.       I = BBStates.find(Succ);
  16.       assert(I != BBStates.end());
  17.       MyStates.MergeSucc(I->second);
  18.     }
  19.     break;                             <<<----
  20.   }
  21.   ...
  22. }
  23.  
  24. This suspicious code was found in Clang project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V612 An unconditional 'break' within a loop. objcarc.cpp 2763
  27.  
  28. 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