Skip to content

Conversation

vepadulano
Copy link
Member

No description provided.

…llection element type

A call to `TTree::Branch` with the branch type being an STL collection with an
element type derived from an unsplittable base class (i.e. with a custom
streamer) would fail with the following error message:

```
Fatal in <TBranchElement::InitializeOffsets>: Could not find the real data member 'objects' when constructing the branch 'objects' [Likely an internal error, please report to the developers].
aborting
```

Due to the fact that InitializeOffsets was not able to properly compute the
offset of the base class of the element type. Unfortunately the error message
itself was obscure, since the repetition of the word 'objects' in this case
simply refers to the top-level branch name.

What is really happening is that the function logic mixes the calculation of the
offsets of base classes with the calculation of offsets of data members of a
class in the same code path. For this reason, the failure should have hinted at
this by specifying that the first 'objects' was actually 'base class of the type
of the objects branch'.

In the particular configuration of an STL collection type, the function needs to
compute the offset of the base class of its element type. The function generally
looks for TRealData of each data member and base class. But when the base class
is unsplittable, this will not work anyway.

The logic of the function is slightly extended so that if the name of the data
member being currently looked at is actually of the type
'nameOfBranch.BaseClassName', i.e. we are not looking for a data member for the
base class of the element type of an STL collection, we remove all the leading
part of the name until the base class name itself.

This helps because other parts of the function compare the current data member
name with the base class name and if they are equal, the data member name is
completely removed. When there is no data member name to look at, the function
simply skips all the logic related to TRealData and directly computes the offset
of the base class, which is the desired behaviour in this case.

A test is added to exemplify the case at hand.

Co-authored-by: Philippe Canal <[email protected]>
Copy link
Member

@pcanal pcanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Copy link

github-actions bot commented Aug 27, 2025

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit a30a00f.

♻️ This comment has been updated with latest results.

@vepadulano vepadulano added the clean build Ask CI to do non-incremental build on PR label Aug 27, 2025
@vepadulano vepadulano closed this Aug 27, 2025
@vepadulano vepadulano reopened this Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean build Ask CI to do non-incremental build on PR pr:backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants