Hi Greg, This seems to be a CINT optimization problem. It runs with optimisation level 3 or below but not with level 4 select root > .O3 I am forwarding the problem to Masa. Rene Brun On Thu, 1 Mar 2001, Gregory Novak wrote: > I'm using Root 2.25.03 and I'm getting segmentation faults I don't > understand. This has something to do with array allocation and > function arguments. I'm loading a bunch of c++ code via .L, containing > the following two functions: > > void profMedian2(Float_t x[], Float_t y[], const Int_t nBins) { > for (Int_t i=0; i<nBins; i++) { > sliceMedian2(x,y,nBins); > } > } > > Float_t sliceMedian2(Float_t x[], Float_t y[], const Int_t n) { > Float_t sortedX[n]; > return 0; > } > > Then I have the following in a macro. > { > Float_t x[500]; > Float_t y[500]; > profMedian2(x, y, 500); > } > > When I run the macro, Root gives me a segmentation fault. There are a few > things that are confusing: The seg fault comes when root tries to call > sliceMedian2, but I can run it directly without trouble. If I change the > arguments of sliceMedian2 or profMedian2, the seg fault goes away. Also, > if I take out the for loop around the call to sliceMedian2, the seg fault > goes away. This is in spite of the fact that the seg fault comes on the > first pass through the loop. > > So, is there any solution to this? > > Thanks! > Greg > > >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:38 MET