PVS-StudioWarnings

PVS-Studio warning V501 for Geant4

Nov 10th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. G4VParticleChange* G4ForwardXrayTR::PostStepDoIt(
  2.   const G4Track& aTrack, const G4Step& aStep)
  3. {
  4.   ....
  5.   if (     iMat == jMat
  6.       || (    (fMatIndex1 >= 0 && fMatIndex1 >= 0)
  7.            && ( iMat != fMatIndex1 && iMat != fMatIndex2 )
  8.            && ( jMat != fMatIndex1 && jMat != fMatIndex2 )  )
  9.   ....
  10. }
  11.  
  12. Most likely this is what should be written here: (fMatIndex1 >= 0 && fMatIndex2 >= 0)
  13.  
  14. This suspicious code was found in Geant4 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: fMatIndex1 >= 0 && fMatIndex1 >= 0 G4xrays g4forwardxraytr.cc 620
  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