Problem 1415 - Expression is always true. Probably the '&&' operator should be used here. g4collisionmesonbaryonelastic.cc 53
Summary: Expression is always true. Probably the '&&' operator should be used here. g4...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/im_r_matrix (show other problems)
Version: 9.6
Hardware: PC Windows
: P5 major
Assignee: Gunter.Folger
URL:
Depends on:
Blocks:
 
Reported: 2012-12-31 13:03 CET by a.ramazani
Modified: 2013-02-04 16:15 CET (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
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.