Problem 943

Summary: G4 Crash in g4hadronicprocess.cc
Product: Geant4 Reporter: porosev
Component: processes/hadronicAssignee: dennis.herbert.wright
Status: RESOLVED FIXED    
Severity: critical    
Priority: P5    
Version: 8.2   
Hardware: All   
OS: All   

Description porosev 2007-05-08 05:09:13 CEST
Hello all!

I have simle bug that leed to crash.. no comments..  in fuction:

G4Element * G4HadronicProcess::ChooseAandZ(
const G4DynamicParticle *aParticle, const G4Material *aMaterial )
{
...
G4double random = G4UniformRand();
  for( i=0; i < numberOfElements; ++i )
  { 
     ...
        for (i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
        {
        }
        for(i=0; i<theIso.GetNumberOfIsotopes(localZ); i++)
        {
        }
     ...
      targetNucleus.SetParameters(currentN, currentZ);
      return (*theElementVector)[i];
    ...
  }
...
}

variable "i" change its value many times inside of inner cycles and as a results
G4 crash when the function try to return value with "i" outside of availbale range!!!!

Please fix this strange code.
Viacheslav Porosev
Comment 1 dennis.herbert.wright 2007-05-08 18:37:24 CEST
This problem has been fixed in the 8.3 release of Geant4, which will be available in a few days.