Possible bug with struct arrays

Greetings all. When a struct contains an object (instead of a pointer), it seems that an array of these structs generates a segfault when being deallocated. If I make a program foo.C:

[code]struct mystruct {
TH2F h1;
TH2F h2;
};

void foo() {
mystruct a;
mystruct b[2];
}[/code]

and execute with “.x foo.C”, there are no problems with a, but when the array b is being destroyed it generates this error message:
!!!Calling destructor 0xc048810.~mystruct() for b ary1:link0
0xc048cf0.~mystruct()
!!!Calling class member destructor ~TH2F()
*** Break *** segmentation violation

I don’t see this problem with ACLiC, so I assume it is with cint. I have tested this with ROOT versions 4.04/02 (cint version 5.15.169) and 4.00/04 (cint 5.15.133) and get the same result.

I apologize if this has already been reported or addressed.

Thanks.

Hi,

I cannot reproduce this with ROOT’s current CVS version, so I assume that it has been solved.

Cheers, Axel.

That’s good news. Unfortunately, I’m stuck with whatever version of ROOT is BNL using, and the upgrade to version 5 has been delayed…

Anyway, thanks for taking a look.

Hi,

sure, no problem. Btw - it’s very easy to build your own root version from sources. It’s really, really worth it, esp when having to work with an incedibly old ROOT version like you do, at least if you don’t depend on tons of ROOT-version sensitive code. If BNL doesn’t update then you just do it yourself :wink:

Cheers, Axel.