schmidt%blanche.ics.uci.edu@ORION.CF.UCI.EDU ("Douglas C. Schmidt") (10/09/88)
Hi,
G++ 1.27 gets a fatal signal for the following short program. This
occurs on a Sun 4:
----------------------------------------
static const int Max_Buf = 100000;
class Binary_Search_Tree {
private:
struct Tree_Node {
static Tree_Node *Base;
void * operator new ( long ) {
return ( Base++ );
}
void operator delete ( void * Ptr ) {
}
Tree_Node () {}
};
public:
Binary_Search_Tree ( void );
~Binary_Search_Tree ( void );
};
Binary_Search_Tree::Binary_Search_Tree ( void ) {
Tree_Node::Base = new Tree_Node [ Max_Buf ];
}
Binary_Search_Tree::~Binary_Search_Tree ( void ) {
delete (Tree_Node *) Tree_Node::Base;
}
----------------------------------------
Here is the diagnostic:
----------------------------------------
g++ version 1.27.0
echo use .cc filename extension!
use .cc filename extension!
/usr/public/lib/g++/gcc-cpp+ -v -I/cd/ua/schmidt/include/ -undef
-D__GNU__ -D__GNUG__ -Dsparc -Dsun -Dunix -D__OPTIMIZE__ bug.C
/tmp/cca13219.cpp GNU CPP version 1.27.0
/usr/public/lib/g++/gcc-c++ /tmp/cca13219.cpp -quiet -dumpbase bug.C
-fchar-charconst -opt -version -o /tmp/cca13219.s
In function void Binary_Search_Tree::~Binary_Search_Tree ():
bug.C:34: Segmentation violation
/usr/public/g++: Program c++ got fatal signal 11.