Crash when saving bool arrays using Snapshot

Hello,

I have a ROOT tree that has bool arrays in a few branches. However, whenever I try to include them in the snapshot it fails, with a segmentation violation. I can save other branches OK. Here’s a branch I can’t write out using Snapshot.
-------
***Br 46 :Electron_mvaSpring16GP_WP80 : Bool_t MVA general-purpose ID WP80 ***
***Entries : 1525773 : Total Size= 7243133 bytes File Size = 614988 ***
***Baskets : 100 : Basket Size= 204288 bytes Compression= 11.77 ***
------

Relevant error message might be:

/home/suyong/work/Tools/root-master/etc/…/include/ROOT/RVec.hxx:283:32: error: cannot initialize return object of type ‘bool *’ with an rvalue of type ‘void’
T *data() noexcept { return fData.data(); }
^~~~~~~~~~~~
/home/suyong/work/Tools/root-master/etc/…/include/ROOT/RDFActionHelpers.hxx:922:67: note: in instantiation of member function ‘ROOT::VecOps::RVec::data’ requested here
auto *const outputBranch = outputTree.Branch(name.c_str(), ab->data(), leaflist.c_str());
^
/home/suyong/work/Tools/root-master/etc/…/include/ROOT/RDFActionHelpers.hxx:976:11: note: in instantiation of function template specialization ‘ROOT::Internal::RDF::SetBranchesHelper’ requested here
(SetBranchesHelper(fInputTree, *fOutputTree, fInputBranchNames[S], fOutputBranchNames[S], &values), 0)…, 0};
^
Best,
Suyong


_ROOT Version: 6.15.01
_Platform: Linux
_Compiler: gcc 6.4.1


Are these std::vector<bool>s? vector<bool> is not an array of bools (https://isocpp.org/blog/2012/11/on-vectorbool).

I think they’re array of bools. When I do MakeClass it is treated as an array, not a std::vector.

Hi Suyong,
As per the c++ standard, vector has different semantics (some methods are missing, some behave differently, thread-safety guarantees are missing) and this makes it pretty evil when used in generic code. You encountered one of the cases in which we were not treating vector specially, as we should have.

The relevant but report is here: https://sft.its.cern.ch/jira/browse/ROOT-9438

All known issues have been solved over the course of the last month in ROOT’s master branch, yours in particular in the last 24 hours :sweat_smile:

I see that you use v6.15 already: would you be able to upgrade to latest master and confirm that the issue is fixed?

Cheers,
Enrico

Hi Enrico,

Fantastic!
I confirm that the bug is fixed in the master branch.

Regards,
Suyong

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.