| Summary: | use of uninitialized variable in G4IonisParamMat.cc | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Chris Pinkenburg <pinkenburg> |
| Component: | materials | Assignee: | Vladimir.Ivantchenko |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | P4 | ||
| Version: | 10.2 | ||
| Hardware: | All | ||
| OS: | All | ||
Hello Chris,
thank you very much for pointing to the bug. The fix is submitted and will be available with the next public release and patches to previous releases. The consequences of the bug I expect minor.
For your application with Geant4 10.2 it is not clear if new patch will be done in near future, however, it is possible to use work around the problem:
G4Material *mRICH_Borosilicate= new G4Material("mRICH_Borosilicate",G4_Pyrex_Glass->GetDensity(),G4_Pyrex_Glass, G4State::kStateSolid);
Even if results are unchanged, in this case, the state is defined and no valgrind complain should be.
VI
|
valgrind flagged the use of an uninitialized variable in line 335: fAdensity = twoln10*(Xa-fX0density) /std::pow((fX1density-fX0density),fMdensity); The reason for this was creating a new material via: G4Material *mRICH_Borosilicate= new G4Material("mRICH_Borosilicate",G4_Pyrex_Glass->GetDensity(),G4_Pyrex_Glass); When called like this the G4State is undefined (as per ctor): G4State state = kStateUndefined, This case is not handled in G4IonisParamMat.cc which expects one of kStateSolid, kStateLiquid, kStateGas in the if statements which set those density values. I don't know if this has any consequences further downstream. Using an explicit state in the call to the ctor (kStateSolid and kStateGas for another material) fixed this on my end: G4Material *mRICH_Borosilicate= new G4Material("mRICH_Borosilicate",G4_Pyrex_Glass->GetDensity(),G4_Pyrex_Glass,G4State::kStateSolid); G4 10.3 should exhibit the same behavior, I did not verify this but a diff for G4IonisParamMat.cc does not show new code in the relevant places.