I’m compiling root-6.24.06 from source with gcc-11.2.0 and got the following warning:
[ 77%] Building CXX object roofit/histfactory/CMakeFiles/HistFactory.dir/src/ConfigParser.cxx.o
/msu/data/t3work3/ivanp/build/gcc11/root-6.24.06/roofit/histfactory/src/ConfigParser.cxx:
In member function 'RooStats::HistFactory::Measurement
RooStats::HistFactory::ConfigParser::CreateMeasurementFromDriverNode(TXMLNode*)':
/msu/data/t3work3/ivanp/build/gcc11/root-6.24.06/roofit/histfactory/src/ConfigParser.cxx:376:41: warning: 'this' pointer is null [-Wnonnull]
376 | << curAttr->GetName() << std::endl;
Taking a quick look at ConfigParser.cxx reveals that there’s indeed a bug. curAttr is defined on line 281, followed immediately by a while loop with the following condition:
TXMLAttr* curAttr = 0;
while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) { . . . }
Clearly, before and after the loop curAttr is null.
The culprit line is located not far below the end of the while loop on line 376, where the member function is called curAttr->GetName(). Clearly, at this point curAttr is null.