PVS-StudioWarnings

PVS-Studio warning V614 for Geant4

Nov 20th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. typedef std::vector<G4Parton *> G4PartonVector;
  2.  
  3. inline
  4. void G4ExcitedString::InsertParton(
  5.   G4Parton *aParton, const G4Parton * addafter)
  6. {
  7.   G4PartonVector::iterator insert_index;
  8.   ....
  9.   if ( addafter != NULL )
  10.   {
  11.     insert_index=std::find(thePartons.begin(),
  12.                            thePartons.end(), addafter);
  13.     ....
  14.   }
  15.   thePartons.insert(insert_index+1, aParton);
  16. }
  17.  
  18. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V614 Potentially uninitialized iterator 'insert_index' used. g4excitedstring.hh 193
  21.  
  22. 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