RE: problem with ROOT 5.08 on SolarisCC5

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 04 Apr 2006 12:46:52 -0500


Hi,

This turns out to be (most likely) a bug in the Solaris CC compiler. I uploaded a work-around in the CVS repository.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Fechner Maximilien
Sent: Monday, April 03, 2006 9:46 AM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] problem with ROOT 5.08 on SolarisCC5

Dear ROOT-ers,

I've come across the following strange behaviour.

I stored 500 'events' in a tree.
This is the relevant part :

   for (int i = 0 ; i< 500 ; i++) {

     count = ((float)i)*1.02;
     tree->Fill();

   }

Then I select events with count>200. :

const float qcut = 200.0;
  for( int i = 0; i < nevts; i++) {
    t1->GetEntry(i);
    nall++;
    if (count > qcut){
     nselected++;
    }
  }

On an intel machine (normal behaviour) the output is :   Total number of events = 500
Selected events: 303
(ROOT v4.04/f

Using ROOT Version 5.08/00, 13 December 2005, on a SUN machine running SunOS 5.8,
SUN CC compiler version 5.3
Compiled on 19 December 2005 for solarisCC5, the result is :   Total number of events = 501
Selected events: 477
--> meaning events for which count is obviously <200. still get selected
(+ ROOT apparently sees an extra event...).

Strangely enough I also noticed that variable "bool a = (count>qcut);" is correctly filled (ie 1 when count>200.). Replacing the if statement with "if (a) {..." solves the problem. e.g.

const float qcut = 200.0;
  for( int i = 0; i < nevts; i++) {
    t1->GetEntry(i);
    bool a = (count>qcut);
    if (a){
      cout << "*" << count << endl;
    }
  }

However in a more complicated version of this macro (attached to this message), in which I fill histograms in the loop, this still gives me the wrong answer unless I add a statement between the declaration of 'a' and the 'if' statement (apparently any statement will do).

I've attached a simple program to build the tree and the macro to read it (2 versions). I'd greatly appreciate your help.

Thanking you in advance,
Maximilien Fechner Received on Tue Apr 04 2006 - 19:50:12 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET