RE:PR#91 - back from trash

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Sat Jan 30 1999 - 14:58:14 MET


Pasha,

The stack trace tells me what's going on. To confirm my understanding, will
you try following.

1) Edit $ROOTSYS/cint/include/iostream.h  at the very end there exists followi
ng  template function. Please commend this out and try getenv. I think the pro
blem  goes away.

  template<class T>
  int G__ateval(const T& x) {   // << Bus error occurs here
    //cout << .....
    return(0);
  }

2) Re-activate above function  and please add following function. Try getenv.
  I hope the problem also goes away. 

  template<class T>
  int G__ateval(const T& x) {
    //cout << .....
    return(0);
  }
  int G__ateval(const char* x) { return(0); }
  int G__ateval(const void* x) { return(0); }

If both 1) and 2) works,  keep 2) in your iostream.h. I'll make this
change to the original.

I need to explain what is happening.
CINT evaluates return value of the interactive expression by using G__ateval
function. In this case, "getenv("HOME")" returns 'const char*'. CINT
instantiates template function 'int G__ateval(const char*& x)'. The argument
is a reference to pointer. getenv returns system defined static memory area
which may be dangerous to get reference of. 
Adding 'int G__ateval(const void* x)' prevents this action.

Let me know how things go.

And finally, please just call me Masa. 

Thank you
Masaharu Goto

-------------------------------------------------------------
Masaharu-san, 
        just want to add that (at least with KAI-compiled version) the crash 
occurs *only* when I invoke root - when I invoke root.exe ROOT doesn't break (
!)Seems to have something to do with the initializations 
(may be non-zeroed memory)... anyway, I hope that the output below can shed 
some light at the problem.
        - pasha.
------------------------------------------------------------------------------
--/cdf/upgrade/tracking/murat/g3/test>root -b
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   2.21/03   22 January 1999   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

CINT/ROOT C/C++ Interpreter version 5.13.87, Jan 8 1999
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
root [0] getenv("HOME")
(char* 0x7ffee03b)"/home/lv0/murat"
root [1] #include <iostream.h>
root [2] getenv("HOME")       
                                  <--------- at this point the code breaks



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:28 MET