Problem 1689 - cut and paste error in inline G4double G4NeutronHPInterpolator::LogarithmicLogarithmic(G4double x, G4double x1, G4double x2, G4double y1, G4double y2) const
Summary: cut and paste error in inline G4double G4NeutronHPInterpolator::LogarithmicLo...
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic/models/neutron_hp (show other problems)
Version: 10.0
Hardware: All All
: P5 minor
Assignee: tkoi
URL:
Depends on:
Blocks:
 
Reported: 2014-11-10 19:43 CET by Chris Pinkenburg
Modified: 2014-11-18 05:20 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 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