Possible bug with static method calls in cint7

The current DoubleChooz analysis code runs on ROOT 5.20.00, and crashed on ROOT 5.21.04. I believe I have traced this to a behavior of cint involving calls to static methods.

I’ve abstracted the code responsible as so

tester.hh:

[code]// Minimal test code to prove a cint behavior that may be a bug
#include

class A {
public:
static void SetConfig(const std::string s);
private:
static std::string configStr;
};

class B {
public:
B();
~B();
static void callThrough(const std::string s);
private:
A* myA;
};[/code]

tester.cc:

[code]// Minimal test code to prove a cint behavior that may be a bug
#include “tester.hh”

std::string A::configStr = std::string();
void A::SetConfig(const std::string s){
configStr=s;
}

B::B():
myA(0)
{}
B::~B(){
if (myA){
delete myA;
myA=0;
};
}
void B::callThrough(const std::string s){
A::SetConfig(s);
};[/code]

this compiles without trouble and cint generates a dictionary just as easily.

When I run a trivial macro to invoke it:

{ gSystem->Load("lib/libtester.so"); B::callThrough("config_info"); }

it crashed on 5.21.04, and works fine with 5.20.00.

I see in the SVN logs that changes have been made to the static method call protection.

Possibly the C++ is wrong. I didn’t write it and don’t claim to have a full understanding of the proper use of static methods.

I’m sticking with ROOT 5.20 for now, but any help would be appreciated.

Hi,

I can reproduce the problem and I am nearing a solution …

Cheers,
Philippe.

PS. Note that eventhough 5.21 introduced a new problem with the call to static function (in the case you have), the code you provided does not work on 5.20 for me due to CINT not handling the class static variable allocation properly (the actual result is random and thus could also result in an apparent success) … anyway both problem should be fixed shortly.

Philippe,
That is what I call service.

Thanks for the fast response and the warning, I will pass it on to my collaborators.

Hi,

This problem has been fixed in the SVN trunk. As a bonus, we added support for std::string as a class static object in interpreted code.

Cheers,
Philippe.