RE:segmentation violation when accessing

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Fri May 07 1999 - 14:46:31 MEST


Dear Walter,

It seems like many people are falling into the same problem. 
I'd like to post this message to roottalk for prevention of this kind
of problem.

The problem only occurs in ROOT and not in bare CINT. This is due to 
ROOT specific reset scheme for iostream.h. Solution to this is 

 *** <iostream.h> MUST BE LOADED IN rootlogin.C ***

{
  printf("\nWelcome to ROOT tutorials\n\n");
  G__loadfile("iostream.h");
}

This will prevent many of the problems you may face with iostream.

Thank you
Masaharu Goto

====================================================================
Full_Name: Walter F.J. Mueller
Version: 2.00/12 - 2.21/08
Hardware: 
OS: Linux and AIX
Severity: major
Reproducable: always
Submission from: rzserv1.gsi.de (140.181.96.11)


There seems to be a problem with the way cout and possibly other standart
streams are handled. The symptoms are:

  root gets a "segmentation violation" when a macro using <iostream.h>
  writes to cout after it has been loaded a second time.

Example:

//---------- error_001.C ----------
#include <iostream.h>

int main()
{
  printf("Hello Brian\n");
  cout << "Hello Bjarne" << endl;
  return;
}
//---------- ----------- ----------

and you'll get

  .L error_001.C
  main();
  main();
  .L error_001.C
  main();

The last call to main() will produce

        Hello Brian
         *** Break *** segmentation violation

so the printf is done but the using cout get it over the edge. Terminating
with ^C and .q has in similar cases given the message

        Fatal in <operator delete>: storage area overwritten
        aborting

Note, that loading twice without execution is no problem:

  .L error_001.C
  .L error_001.C
  main();                       // fine
  .L error_001.C
  main();                       // crash

This behaviour was seen on our Linux systems as well as on AIX:

        root    OS

        2.21/08 Debian 2.1      (libc.so.6)
        2.00/13 Debian 2.1      (libc.so.6)
        2.00/13 Debian 1.3.1    (libc.so.5)
        2.00/12 AIX 4.1.5.0

Remarkable is, that the same sequence of commands works fine with cint !!


                        With best regards,      Walter



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