Filling Tree with Double_t and Int_t problem

Happy new year everyone.

So I’ve encountered a strange problem. I have defined a struct with two alternating Double_t and Int_t variables and fill a Tree with these variables as Leaves. Only the first two Leaves have the correct values, the final two have strange/incorrect values. The complete sample code is as follow:

#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <ctime>
#include <math.h>
#include "TTree.h"


struct DataSTRUCT{
  Double_t E1; Int_t A1; Double_t E2; Int_t A2;
};

void testing(){

  DataSTRUCT Data;
  
  TFile *outfile;
  outfile = new TFile("output.root","RECREATE","ROOT file");
  outfile->SetCompressionLevel(1);
  TTree *cleanTree = new TTree("Tree","Tree");
  cleanTree->SetAutoSave(1000000000);
  cleanTree->Branch("Data",&Data.E1,"E1/D:A1/I:E2/D:A2/I");
  
  for (int event=0; event<100; event++){
    Data.E1  = 10.0;
    Data.E2  = 20.0;
    Data.A1  = 1;
    Data.A2  = 2;
    cleanTree->Fill();
  }
  outfile->Write();
  outfile->Close();
}

Ok I hang my head in shame for the previous alarmist post. [url][Bug Report] Serious bug in v 5.28 to v5.34-09

See the last paragraph in the “==> Case A” section of the TTree class description.