function never called by TF2::Draw()? (IRIX and Linux)

Petar Maksimovic (petar@mit1.fnal.gov)
Mon, 11 May 1998 23:19:53 -0500


Hi Rene,

my previous example (after your fixes) still causes problems, and
can be boiled down to:

------------8<---------------------------------------------------------
// file: test.C
//____________________________________________________________________________
// tfun1() is used in TF2 constructor and called by TF2.Draw()
//
Double_t tfun1(Double_t* x, Double_t* par)
{
Double_t res;

// Uncomment one of the following two lines. The second one
// will cause TF2::Draw() to never execute this function.
//Double_t xe[4]; // ***** THIS WORKS ON SGI *****
Double_t xe[4] = {0.0, 0.0, 0.0, 0.0}; // ***** THIS DOESN'T *****

xe[0] = x[0] + 0.845;
xe[1] = x[0] * x[1] * 0.246;
xe[2] = 0.941;

res = xe[0]+xe[1]+xe[2];

printf("Result = %f\n", res);
return res;
}
------------8<---------------------------------------------------------

I execute it by typing:

root [0] .L test.C
root [1] TF2 *f2 = new TF2("t",tfun1,0.,1.,0.,1.,0);
root [2] f2->Draw();

The problem is caused by the line

Double_t xe[4] = {0.0, 0.0, 0.0, 0.0};

If "= {0.0, 0.0, 0.0, 0.0}" is removed, it works fine on IRIX 6.2.
However, on Linux (RedHat 5.0) it bombs with

Error: Array index out of range xe+1082958485 valid upto xe[3] FILE:/home/petar/root/./test.C LINE:5
Error: Array index out of range xe+1083297580 valid upto xe[3] FILE:/home/petar/root/./test.C LINE:5
Error: Array index out of range xe+1082958638 valid upto xe[3] FILE:/home/petar/root/./test.C LINE:5

Both IRIX and Linux versions of root are 2.00/05.

On the other hand, if "= {0.0, 0.0, 0.0, 0.0}" is included, the function
tfun1 is never called by TF2::Draw()! (This happens on both IRIX 6.2
and Linux RH 5.0.)

Let me know what other kind of information I can provide (machine or OS
details, etc.)

Thanks a lot!

Petar

P.S. Ultimately, I wouldn't mind CINT refusing to handle some cases, but it
would, at least, be nice that it informs the user what it's doing...