Is this a bug of tables?

Hey all… I am trying to divide some histograms and I have created arrays. So, for the division I use this:

for(j=0; j<7; j++)
{
	pt_mad_divs[j]=(TH1F*)pt_mad_hist[j+1]->Clone();
	pt_mad_divs[j]->Reset();
	pt_mad_divs[j]->Divide(pt_mad_hist[j+1], pt_mad_hist[0]);
	
	pt_axi_divs[j]=(TH1F*)pt_axi_hist[j+1]->Clone();
	pt_axi_divs[j]->Reset();
	pt_axi_divs[j]->Divide(pt_axi_divs[j+1], pt_axi_divs[0]);
}

This code crashes!! It compiles but it crashes at the execution. If I use:

            pt_mad_divs[0]=(TH1F*)pt_mad_hist[1]->Clone();
	pt_mad_divs[0]->Reset();
	pt_mad_divs[0]->Divide(pt_mad_hist[1], pt_mad_hist[0]);
	
	pt_axi_divs[0]=(TH1F*)pt_axi_hist[1]->Clone();
	pt_axi_divs[0]->Reset();
	pt_axi_divs[0]->Divide(pt_axi_divs[1], pt_axi_divs[0]);

it works fine!!! But it doesn’t make sense!!! It isn’t different from the other above!
Please… any help about these errors??

Looking at:
for(j=0; j<7; j++)
I assume you have at least:
TH1F* pt_mad_hist[8]; // 8 or more (right side of assignments)
TH1F* pt_mad_divs[7]; // 7 or more (left side of assignments)
but then, I don’t understand what you try to achieve with “pt_axi_hist” and “pt_axi_divs”:
TH1F* pt_axi_hist[8] // 8 or more (right side of assignments)
TH1F* pt_axi_divs[8]; // 8 or more (right side of assignments - but see the next line!!!)
TH1F* pt_axi_divs[7]; // 7 or more (left side of assignments - but see the previous line!!!)
What’s more important, in the line:
pt_axi_divs[j]->Divide(pt_axi_divs[j+1], pt_axi_divs[0]);
the “pt_axi_divs[j+1]” will possibly be used uninitialized (segmentation violation guaranteed?), unless you initialized all “ppt_axi_divs[8]” pointers in advance (in the source code that you do do show here).
Maybe you wanted to say:
pt_axi_divs[j]->Divide(pt_axi_hist[j+1], pt_axi_hist[0]);