Smith, Jeff W. (jsmith++at++smtpgate.gstone.com)
Fri, 17 Mar 1995 13:12:39 -0800
class crash
{
public:
crash() {}
~crash() {}
void crashit();
void donothing() {}
private:
static crash q1;
};
// since statics need to be init external to class decl
crash crash::q1;
void crash::crashit()
{
q1.donothing();
}
void main()
{
crash q1, q2;
}
This works under C++ 4.0 and 3.2, and I think it gives you what you need.
-- Jeff WS
----------------------------------------------------------------------------
-----
GreyStone Technology Inc. jsmith++at++gstone.com
----------------------------------------------------------------------------
-----
----------
From: Jim Helman
To: Michael J. Smith
Cc: info-performer
Subject: Re: strange seg-fault under IRIX5.3
Date: Thursday, March 16, 1995 4:51PM
This is a C++ bug in 5.3 concerning initialization of static
C++ objects that was found by another info-performerite. It
will be fixed in the next IRIX release. A easy workaround is
to create a dummy static instance of the class outside of the
routine.
-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
|
-----------------------------------------------------------------------------
------ Message Header Follows ------
Received: from realityone.gstone.com by smtpgate.gstone.com
(PostalUnion/SMTP(tm) v2.1.3 for Windows NT(tm))
id AA-1995Mar16.165140.1024.4702; Thu, 16 Mar 1995 16:51:40 -0800
Received: from SGI.COM by realityone.gstone.com via SMTP
(931110.SGI/930416.SGI.AUTO)
for jsmith++at++smtpgate.gstone.com id AA24059; Thu, 16 Mar 95 16:53:13
-0800
Received: from holodeck.asd.sgi.com by sgi.sgi.com via ESMTP
(950221.405.SGI.8.6.10/910110.SGI)
id QAA17678; Thu, 16 Mar 1995 16:47:44 -0800
Received: by holodeck.asd.sgi.com (940816.SGI.8.6.9/940406.SGI.AUTO)
for info-performer-dist id QAA18076; Thu, 16 Mar 1995 16:30:59 -0800
Received: from giraffe.asd.sgi.com by holodeck.asd.sgi.com via SMTP
(940816.SGI.8.6.9/940406.SGI.AUTO)
for <info-performer++at++holodeck.asd.sgi.com> id QAA18073; Thu, 16 Mar 1995
16:30:58 -0800
Received: from surreal.asd.sgi.com by giraffe.asd.sgi.com via SMTP
(931110.SGI/930416.SGI)
for info-performer++at++holodeck.asd.sgi.com id AA04546; Thu, 16 Mar 95
16:30:26
-0800
Received: from localhost by surreal.asd.sgi.com via SMTP
(940816.SGI.8.6.9/940406.SGI.AUTO)
id QAA10137; Thu, 16 Mar 1995 16:30:46 -0800
Message-Id: <199503170030.QAA10137++at++surreal.asd.sgi.com>
To: "Michael J. Smith" <smith++at++vsl.ist.ucf.edu>
Cc: info-performer++at++holodeck.asd.sgi.com
Subject: Re: strange seg-fault under IRIX5.3
In-Reply-To: Your message of "Thu, 16 Mar 95 18:45:41 EST."
<Pine.SGI.3.91.950316184315.21069A-100000++at++widget.vsl.ist.ucf.edu>
Date: Thu, 16 Mar 95 16:30:41 -0800
From: Jim Helman <jimh++at++surreal.asd.sgi.com>
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:05 PDT