odd program behaviour, gcc 2.96 ??

From: Djamel Ouerdane (ouerdane@nbi.dk)
Date: Tue Apr 09 2002 - 06:11:20 EDT

  • Next message: Claus O. E. Jorgensen: "Global tracks sharing same local front track"

    Hi all,
    
    I got a weird behaviour from a program that I used to run without any 
    problem. I recompiled brat and some private libraries after redhat 7.2 was 
    installed and things weird happened then: I could not get an object from 
    an event node by name like we always do. I ran through gdb and couldn't 
    understand why it failed to get the object (sorry, I haven't saved the gdb 
    messages).
    
    Then I remembered having heard that redhat 7.2 has gcc 2.96, well known to 
    be buggy. So, I was crazy enough to clean everything, compiled my own root 
    with gcc3 and brat with gcc3 as well. I then recompiled my own lib and 
    things worked fine. 
    
    BUT, I should warn people who want to use gcc3 that this compiler is much 
    more strict. I got some problems with the mult modules and calibration 
    classes. The following sequence does not compile:
    
       TString filename = "some file"; 	
       ifstream file(filename.Data(), ios::in); 
       if (!file) {
          filename = "other file";	
          file.open(filename.Data());
          if (!file) 
    	return;
       }
    
    This sequence is the basic stuff of ReadASCIIfile (Br[Si,Tile]TmpCalibration)   
    The way I fixed it is:
      ifstream* file = new ifstream(filename.Data(), ios::in);
      if (!*file) {
          filename = "other file";	
          file = new ifstream(filename.Data());
          if (!*file) 
    	return;
       }
    
       *file >> ... ;
       if (file->fail())
          ...
    
    
    Another thing: ios::noreplace crashed the compilation (in mult 
    calibration modules). I don't know why and I simply removed it.
    
    
    Final problem: I had to cast arguments to Double_t in TMath::[Min,Max]
    (still in mult modules). 
    
    
    That's all for now.   
    
    Djam
       
    Djamel Ouerdane ------------------------------------------o
    |  Niels Bohr Institute      |  Home:                     |
    |  Blegdamsvej 17, DK-2100 Ø |  Jagtvej 141 2D,           |
    |  Fax: +45 35 32 50 16      |  DK-2200 Copenhagen N      |
    |  Tel: +45 35 32 52 69      |  +45 35 86 19 74           |
    |                  http://www.nbi.dk/~ouerdane            |
    |                  ouerdane@nbi.dk                        |
    o---------------------------------------------------------o
    



    This archive was generated by hypermail 2b30 : Tue Apr 09 2002 - 06:12:06 EDT