Problem 1689

Summary: cut and paste error in inline G4double G4NeutronHPInterpolator::LogarithmicLogarithmic(G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
Product: Geant4 Reporter: Chris Pinkenburg <pinkenburg>
Component: processes/hadronic/models/neutron_hpAssignee: tkoi
Status: RESOLVED FIXED    
Severity: minor CC: pinkenburg
Priority: P5    
Version: 10.0   
Hardware: All   
OS: All   

Description Chris Pinkenburg 2014-11-10 19:43:45 CET
scan-build was tripped off by "result" not being used, the value of result gets overwritten by the general else in line 172 after if(y1==0||y2==0) result = 0;

Starting at line 164 of G4NeutronHPInterpolator.hh:

inline G4double G4NeutronHPInterpolator::
	LogarithmicLogarithmic(G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
	{
	G4double result;
	if(x==0) result = y1+y2/2.;
	else if(x1==0) result = y1;
	

	else if(x2==0) result = y2;
	if(y1==0||y2==0) result = 0;
	else
	{
	result = LinearLinear(std::log(x), std::log(x1), std::log(x2), std::log(y1), std::log(y2));
	result = std::exp(result);
	}
	return result;
	}

I don't know if this has any consequences when running G4
Comment 1 tkoi 2014-11-18 05:20:36 CET
Thank you for reporting this problem. 

I’ve confirmed this problem and will fix shortly. 
Anyway, the overwritten should not happen in calculations, otherwise we got lethal core dump immediately after. 

Tatsumi