[ROOT] GCC Optimisation and SIGSEGV from TTree::Scan

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Mon Jul 16 2001 - 11:41:33 MEST


Hi ROOT'ers et al, 

I'm experiencing a very strange error when I compile a class for
handling a ROOT file with a TTree in it.  Basically the class opens a
TFile and creates a TTree in it.  

On a single processor i386, running GNU/Linux (Redhat 6.2), using 2nd
level optimisation (-O2), ROOT 3.01/06, everything works fine.   

On a dual processor i386, runnning GNU/Linux (Redhat 6.1), using the
same optimisation and ROOT version, the class crashed with SIGSEGV
after lines like: 

    fTree = new TTree("T","BRAT Event Tree");
    fTree->SetAutoSave(5000000);  // autosave when 5 Mbyte written

Running the program in the debugger says that the SIGSEGV comes from 

    0x413f509f in TTreePlayer::Scan ()

and a trace gives 

    #0  0x413f509f in TTreePlayer::Scan ()
    from /afs/rhic/opt/brahms/new/lib/libTreePlayer.so
    #1  0x40a20a91 in TTree::Scan ()
    from /afs/rhic/opt/brahms/new/lib/libTree.so.3.01
    #2  0x40dc86bf in BrEventIO::InitializeRootTreeFile ()

(BrEventIO is the class in question).  Now, looking through the code,
I see absolutly no where where the message TTree::Scan is send.  The
code continues like 

    BrEvent *dummy = new BrEvent("ev",0,0);
    fBranch = fTree->Branch("event","BrEvent", &dummy,fBufsize,fSplit);
    delete dummy;

Then I tried to compile the class in question on the SMP GNU/Linux
machine with only first level optimisation (-O1) and no optimisation,
and everything works smoothly. 

I know the compiler on Redhat 6.1 is really old 

    gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

and probably a newer compiler will do the trick.  However, that is not
an option in our case.  Also, when I compiled ROOT I used the
linuxegcs configuration which also only has 1st level optimisation.  

I searched ROOT talk for anything pertaining to the GCC optimisation,
but only found 

  http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk00/2581.html?Optimization#first_hit

which seems to be the same problem, but Rene's answer that didn't
really help much (quite understandable, since this is probably a very
compiler/os/machine specific thing).  

So the question is: Has anyone else seen this?  Does anyone know what
could be wrong?  

And also: Heads up to those using Redhat 6.1 on an SMP machine! 

Yours, 

Christian  -----------------------------------------------------------
Holm Christensen                             Phone:  (+45) 35 35 96 91 
  Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
  DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
  Denmark                                    Email:       cholm@nbi.dk



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:52 MET