Jim Helman (jimh++at++surreal)
Thu, 16 Mar 95 16:30:41 -0800
-jim
Date: Mon, 23 Jan 1995 19:26:25 -0500 (EST)
From: "Michael J. Smith" <smith++at++vsl.ist.ucf.edu>
To: performer <info-performer++at++sgi.sgi.com>
Subject: C++ compiler -- does it work?
Ok, I know this may be somewhat unrelated to the main focus of this
group, but when I compiled some code under 5.3, I got a cool little
segment fault. I managed to write a small program that produces this
fault and it boils down to a static variable inside a method call.
Is this not supported by the C++ language? Here's the code
--------------------------------------------
class crash
{
public:
crash() {}
~crash() {}
void crashit();
};
void crash::crashit()
{
static crash tq; // comment out this line and it doesn't crash
// crash tq; // with this line it doesn't crash...
}
void main()
{
crash q1, q2;
}
// Compile this program with CC crash.C
// run a.out and see a nice seg fault on IRIX5.3 -- dbx says
// Core from signal SIGSEGV: Segmentation violation
//(dbx) > 0 _fini(0x400c2c, 0x0, 0x0, 0x0)
// ["../patch/c++init.c++":76, 0x400c60]
// 1 <stripped>() [<stripped>, 0xfb6b3d4]
//
----------------------------------------------
If anyone can explain this I'd love to hear it. I suppose I can use
another technique, but this exact code will run without any problems on
any of the eariler compilers...
Any answers are welcomed....
-----------------------------------------------------------------------------
| Michael J. Smith University Of Central Florida |
| Visual Systems Laboratory Institute for Simulation & Training |
| Graduate Research Assistant 3280 Progress Drive |
| smith++at++vsl.ist.ucf.edu Orlando, FL 32826-0544 |
| ++at++cs.ucf.edu |
-----------------------------------------------------------------------------
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:05 PDT