root icon indicating copy to clipboard operation
root copied to clipboard

[io] Wrong member offset in streamer info with read rules

Open jblomer opened this issue 1 year ago • 1 comments

Check duplicate issues.

  • [X] Checked for duplicates

Description

For a class with read rules, data members may report wrong offsets (see reproducer).

Reproducer

infobug.tar.gz

In the attached reproducer, the output of offset is

$ ./offset 
0
8
0

StreamerInfo for class: Event, version=3, checksum=0x153ea7a
  Event@@3       @@alloc         offset=  0 type=1001                     
  float          pt              offset=  8 type= 5  (cached)                     
  float          pt              offset=  0 type= 5  (write)                     
  Event@@3       @@dealloc       offset=  0 type=1002                     
   i= 0, @@alloc         type=1001, offset=  0, len=1, method=0
   i= 1, pt              type=  5, offset=  8, len=1, method=0 [cached]
   i= 2, pt              type=  5, offset=  0, len=1, method=0 [write]
   i= 3, @@dealloc       type=1002, offset=  0, len=1, method=0

Demonstrating that pt is reported with an offset of 8 by the streamer info element.

The wrong offset in the streamer info seems to stem from TStreamerInfo::BuildOld, which adds a second, faulty cached member to the list of streamer info elements.

ROOT version

master

Installation method

From sources

Operating system

Linux

Additional context

No response

jblomer avatar Jun 18 '24 09:06 jblomer

The output is as intended but the problem is that TStreamerInfo::GetDataMemberOffset is returning the offset of the cached member rather than the write (or repeat) member (i.e. the real live member).

pcanal avatar Aug 23 '24 14:08 pcanal

Maybe related: https://its.cern.ch/jira/browse/ROOT-10516

ferdymercury avatar May 06 '25 08:05 ferdymercury