RE: [ROOT] floating point exception in gHtml.MakeClass

From: Ruben Shahoian (Ruben.Shahoyan@cern.ch)
Date: Wed Jan 30 2002 - 11:55:43 MET


Dear Axel and Rene
the class NaElem is one of the base classes of
quite large package (>20Mb it is modified version of Aliroot).
To produce compact example I stripped away lot of things, 
but then it stopped to crash and produced normal documentation.
So the problem is its interaction with other classes, but they are
to many to post of roottalk.
But I found where exactly it crashes: in THtml::Class2Html(...) 
it tries to takelogarithm of the TDataMember::GetMaxIndex() which 
for some reasons returns negative value.

 // Take in account the room the array index will occupy
...
    len2 += Int_t(TMath::Log10(member->GetMaxIndex(indx))) +3; 


The piece of THtml::Class2Html method which I put in the macro
(I attach it bellow) produced following result

member:  const enum NaElem:: kBack   dim = 0
member:  const enum NaElem:: kFace   dim = 0
member:  const enum NaElem:: kDummy   dim = 0
member:  const enum NaElem:: kDisk   dim = 0
member:  const enum NaElem:: kBrik   dim = 0
member:  const enum NaElem:: kTube   dim = 0
member:  const enum NaElem:: kTubs   dim = 0
member:  const enum NaElem:: kCone   dim = 0
member:  const enum NaElem:: kTrap   dim = 0
member:  const enum NaElem:: kHexagon   dim = 0
member:  const enum NaElem:: kInit   dim = 0
member:  const enum NaElem:: kBldGeom   dim = 0
member:  const enum NaElem:: kCreGeom   dim = 0
member:  const enum NaElem:: kDisabled   dim = 0
member:  const char fgkDefMatName   dim = 1
member->GetMaxIndex(indx) returns:  -2147483648

 *** Break *** floating point exception
Root > Function ttt() busy flag cleared

The member which produced an error is 

 protected:
  static const char fgkDefMatName[];    

It is initialized in .cxx as 
const char NaElem::fgkDefMatName[]="AIR"; 

I hope this information will tell you sometinig.
The class definition is in the attached tar.gz

Best regards,
     Ruben


// Extracted from THtml::Class2Html 
{
  // make a loop on data members
  TClass* classPtr = NaElem::Class();
  TDataMember *member;
  TIter nextMember(classPtr->GetListOfDataMembers());
 
  Int_t len1, len2, mtype, num[3];
  len1 = len2 = mtype = num[0] = num[1] = num[2] = 0;
  Int_t ndata = classPtr->GetNdata();
  // if data member exist
  if (ndata) {
    TDataMember **memberArray = new TDataMember *[3 * ndata];
    if (memberArray) {
      while ((member = (TDataMember *) nextMember())) {
	if (!strcmp(member->GetName(), "fgIsA")) continue;
	memberArray[mtype * ndata + num[mtype]] = member;

	if (kIsPrivate & member->Property())
	  mtype = 0;
	else if (kIsProtected & member->Property())
	  mtype = 1;
	else if (kIsPublic & member->Property())
	  mtype = 2;

	if (member->GetFullTypeName()) {
	  len1 = strlen((char *) member->GetFullTypeName());
	  printf("member:  %s ",member->GetFullTypeName());
	}
	else
	  len1 = 0;
	if (member->GetName()) {
	  len2 = strlen(member->GetName());
	  printf("%s   ",member->GetName());
	}
	else
	  len2 = 0;
	
	if (kIsStatic & member->Property())
	  len1 += 7;
	
	// Take in account the room the array index will occupy

	Int_t dim = member->GetArrayDim();
	printf("dim = %d\n",dim);

	for (Int_t indx = 0; indx < dim; indx++) {
	  printf("member->GetMaxIndex(indx) returns: %d\n",
                  member->GetMaxIndex(indx));
	  // !!! 
          //!!!CRASHES HERE
	  len2 += Int_t(TMath::Log10(member->GetMaxIndex(indx))) + 3;
	  // !!!
	}
      }
      delete[]memberArray;
    }
  }
  // ...
}



On Tue, 29 Jan 2002, Axel Naumann wrote:

> Dear Ruben,
> 
> I lost my cern afs access about 2 years ago. Could you please send me the
> class you're trying to document (source + header)? I'll try to find out what
> the problem is.
> 
> Cheers, Axel.
> 

On Tue, 29 Jan 2002, Rene Brun wrote:

> Ruben,
>
> Could you prepare a small tar file with all the *.h *.cxx files
necessary
> as well as a makefile such that I can build a shared lib to test your
problem.>
> Rene
>




> > -----Original Message-----
> > From: owner-roottalk@pcroot.cern.ch
> > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Ruben Shahoian
> > Sent: Tuesday, January 29, 2002 3:18 AM
> > To: roottalk@cern.ch
> > Subject: [ROOT] floating point exception in gHtml.MakeClass
> >
> >
> > Hello,
> > I am trying to generate documentation for my class
> > (Root 3.02.07) but getting following error.
> > NaElem.h appeares in destination directory, but
> > NaElem.html seems to be truncated and without data
> > members. Does anybody know what can be the problem?
> >
> > Best regards,
> >      Ruben Shahoian
> >
> > PS the source code NaElem.cxx/h is in
> > /afs/cern.ch/user/s/shahoian/public/naelem/
> >
> > ~/NA60 > na60root
> >   *******************************************
> >   *                                         *
> >   *        W E L C O M E  to  R O O T       *
> >   *                                         *
> >   *   Version   3.02/07   10 January 2002   *
> >   *                                         *
> >   *  You are welcome to visit our Web site  *
> >   *          http://root.cern.ch            *
> >   *                                         *
> >   *******************************************
> >
> > Compiled for linux with thread support.
> >
> > CINT/ROOT C/C++ Interpreter version 5.15.25, Jan 6 2002
> > Type ? for help. Commands must be C++ statements.
> > Enclose multiple statements between { }.
> > root [0]   gROOT.Reset();
> > root [1]   new THtml();
> > root [2]   gHtml.SetSourceDir("./STEER");
> > root [3]   gHtml.MakeClass("NaElem");
> >                    /home/shahoian/NA60/html/NaElem.html
> >
> >  *** Break *** floating point exception
> > Root >
> >
> >
> >
> >
> 
> 







This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET