[Gate-users] Segmentation fault in gate_v4.0.0 on OS X 10.5

Erin McKay erin at computerhead.com.au
Thu Sep 18 08:58:57 CEST 2008


Hi all.

I have had a problem building Gate v4.0.0 on a Core 2 Duo mac running OS X 10.5 (Leopard).

The program appears to build correctly (with gcc 4.0.1) for the i386 architecture. However, when 
it is executed, entering 'exit' at the first command prompt produces a segmentation fault.

I have localised the fault to the declaration of the static class variable 'm_sEmCalculator' in the 
file 'GateCrossSectionTable.cc'. This class variable is only used in one function (AddMaterial). 
Replacing it with a local static variable eliminates the segmentation fault.

The action of the modified class should be identical. Only the lifetime of the static variable (and its 
destruction order) has changed.

To apply this fix:

Find and open the source file "GateCrossSectionTable.cc"
Comment out the definition of the static (class) variable m_sEmCalculator at the top of the file.
Insert a local variable "G4EmCalculator myEmCalculator;" at the top of the function 'AddMaterial'
Replace the reference to 'm_sEmCalculator' in this function with the new 'myEmCalculator'

For tidyness, comment out the static variable declaration in the "GateCrossSectionTable.hh" 
header file.

Compile and test.


-- 
Erin McKay
Lead Programmer & Tea Boy
Computerhead






More information about the Gate-users mailing list