floating point exception with a loop

From: Alexis Cothenet <cothenet_at_cppm.in2p3.fr>
Date: Tue, 1 Mar 2005 10:10:29 +0100 (CET)

Hi all,

I have seen something very strange using the 4.02 ROOT binary version.

I have a macro test1.C:

void test1(){

   gROOT->ProcessLine(".L test2.C");
   for (int i=0;i<1;i++){
   DoCalib("coucou");
   }
}

and test2.C :
int DoCalib(char * a_filename){

   if(0){

     TFile *f = new TFile(a_filename,"UPDATE");
     TNtuple *ntuple = (TNtuple*)f->Get("dataSP2");
     const int N = ntuple->GetEntries();//it is the origin the error 
message
     //  const int N = 5;//works well with that!
     float newindex[3][N];
     for (int Z=0;Z<3;Z++){
 	for (int Y=0; Y<N ;Y++){
 	  newindex[Z][Y] = -1.0;
 	}
       }

   }
   return 0;
}

When i run .L test1.C then test1()
i have the problem :
*** Break *** floating point exception
Root > Function test1() busy flag cleared Function DoCalib() busy flag cleared

The problems is coming from the definition of "const int N" in test2.C

If i put const int N = 5, it works well. And if i let const int N = ntuple->GetEntries() but in test1.C, put DoCalib("coucou");
without any loop, it works well...

Does someone has an idea in order i could let my macro test1.C with a loop ?

Thanks very much in advance.

Regards,
Alexis Received on Tue Mar 01 2005 - 10:10:40 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET