Skip to content

[io] Leaf count array source requires also leaf count branch? #22329

@hahnjo

Description

@hahnjo

Check duplicate issues.

  • Checked for duplicates

Description

It appears that a rule trying to read a leaf count array must also specify the leaf count branch. This is logical in most cases, but sometimes the user can infer the size from other information, for example because it's always constant (single element). In the worst case, this should be documented but I guess it could be taken care of automatically?

Reproducer

A reproducer is SoAEvolv.source.tar.gz which is writing

struct SoAEvolv {
   int fElements = 0;
   float *fA = nullptr; //[fElements]

   ClassDefNV(SoAEvolv, 2)
};

and then trying to evolve it with

#pragma read sourceClass="SoAEvolv" source="float *fA" version="[-2]" targetClass="SoAEvolv" target="fA" code="{printf(\"onfile.fA = %p\n\", onfile.fA);}"

not specifying fElements. When running ./read_soaevolv the output is:

onfile.fA = (nil)
Error in <TBufferFile::CheckByteCount>: object of class SoAEvolv read too few bytes: 7 instead of 11

showing that ROOT didn't even populate onfile.fA...

ROOT version

6.36, but also latest master

Installation method

CMSSW, but also from source

Operating system

Linux

Additional context

FYI @Electricks94

Metadata

Metadata

Assignees

Labels

bugexperimentAffects an experiment / reported by its software & computimng expertsin:I/O

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions