Re: strange seg-fault under IRIX5.3

New Message Reply Date view Thread view Subject view Author view

Jim Helman (jimh++at++surreal)
Thu, 16 Mar 95 16:30:41 -0800


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 |
    -----------------------------------------------------------------------------


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:05 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.