Problem 1415

Summary: Expression is always true. Probably the '&&' operator should be used here. g4collisionmesonbaryonelastic.cc 53
Product: Geant4 Reporter: a.ramazani
Component: processes/hadronic/models/im_r_matrixAssignee: Gunter.Folger
Status: RESOLVED FIXED    
Severity: major CC: a.ramazani
Priority: P5    
Version: 9.6   
Hardware: PC   
OS: Windows   

Description a.ramazani 2012-12-31 13:03:26 CET
Expression is always true. Probably the '&&' operator should be used here. g4collisionmesonbaryonelastic.cc 53
 
Error:
   if(   (GetNumberOfPartons(p1) != 2 || GetNumberOfPartons(p2) != 3)
       ||(GetNumberOfPartons(p1) != 3 || GetNumberOfPartons(p2) != 2) ) 

Correct:
   if(   ( GetNumberOfPartons(p1) != 2 && GetNumberOfPartons(p1) != 3 )
       ||( GetNumberOfPartons(p2) != 2 && GetNumberOfPartons(p2) != 3 ) ) 


http://files.viva64.com/beta/PVS-Studio_setup.exe

i used The Best C++ static code analysis Tools "PVS-Studio 4.77" under  for VS 2012 to analyse the  Geant4.9.6 code
there is many warnings and performace optimization so i recommend using PVS-Studio 

please correct me if i am wrong 
Thanks in Advance.
Comment 1 Gunter.Folger 2013-01-08 08:45:52 CET
Fixed in development version.
Need to validate effect of this fix.
Comment 2 Gunter.Folger 2013-02-04 16:15:29 CET
Thanks for reporting this clear bug.

Bug fixed in development version; effect need to be validated.