RE:another cint problem?

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Jan 25 2000 - 13:57:35 MET


Hello Nicolas,

I could not reproduce your problem.  Simple test program below
works without problem. Is there anything I am missing?

Thank you
Masaharu Goto


class a {
 public:
  int a;
  int xsize() { return a; }
};

a& g(a& x) {
  return x;
}

a x;

int f1() {
  a* ppa[5];
  ppa[0] = &x;
  return g(*ppa[0]).xsize();
}

int f2() {
  a* ppa[5];
  ppa[0] = &x;
  return g(*(ppa[0])).xsize();
}

main() {
  x.a = 1234;
  printf("%d\n",f1());
  printf("%d\n",f2());
}


>root 
>Version   2.23/11   14 January 2000 
>CINT/ROOT C/C++ Interpreter version 5.14.25, Nov 25 1999
>
>In some method the line:
>
>return fNx_base*(*fToe[0]).xsize();} 
>
>make a seg violation in the trivial xsize() method
>fToe is a ** on some object
>fToe and fToe[0] point on correctely constructed objects
>
>Now if I edit the line to (I think equivalent line):
>return fNx_base*(*(fToe[0])).xsize();
>then it works.
>
>g++ seems to like both of the forms.
>
>
>Here is the end of the trace:
>209  Blocktoeplitz::xsize() const{
>210     if (fNy_base>0){
>211         return fNx_base*(*fToe[0]).xsize();}
>
># toeplitz.h
>76   Uttoeplitz::xsize() const{
>77      return fX_dim;}
>
> *** Break *** segmentation violation
>Root > Function doit() busy flag cleared
>Function xsize() busy flag cleared
>Function xsize() busy flag cleared
>Function show() busy flag cleared
>
>
>-- 
>              Nicolas Produit



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET