Hello Ranpal and Rene, Sorry for long silence. I could not reproduce this problem. The program works fine on my machine. Thank you Masaharu Goto >Date: Mon, 8 Apr 2002 23:15:12 +0200 (METDST) >From: Rene Brun <Rene.Brun@cern.ch> >To: Ranpal Singh Dosanjh <Ranpal.Singh.Dosanjh@cern.ch> >Cc: cint@pcroot.cern.ch, roottalk@pcroot.cern.ch >Subject: [CINT] Re: [ROOT] Segmentation fault in loop with mask > >Hi Ranpal, > >This is unfortunately a CINT problem when an object is created >inside an if block, itself in a loop. >The solution is to change your code as shown below. >I hope that Masa will fix this problem in a coming version of CINT. > >Rene Brun > >On Mon, 8 Apr 2002, Ranpal Singh Dosanjh wrote: > >> Dear rooters, >> >> I have a bizarre segmentation fault which I am trying to understand, and >> I hope someone can help me. I've reduced the problem to the following >> macro: >> >> { >> gROOT->Reset(); >> >> Int_t i=1; >> Int_t n = 3; >> Int_t mask[n]={0,0,1}; >> > TString hello; > >> for (i=0;i<n;i++) { >> if (mask[i]) { >> hello = "hello"; >> cout << hello << endl; >> } >> } >> >> } >> >> This results in a segmentation fault. However, if mask is, say, {1,0,1}, >> then there is no segmentation fault, and the macro behaves as expected. >> In fact, the only configuration of mask elements for which a segmentation >> fault occurs is zero in the first element and at least one non-zero >> element. >> >> I'm running root 3.02/07 on Linux, if it makes a difference. >> >> Thanks, >> >> Ranpal >> >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:51 MET