This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

gcc 3.0 C++ exception run-time crash on SPARC with -O2


Folks, 

Here is a small test case that result in a run-time crash (SIGSEV)
when using GCC 3.0, sparc architecture, optimized code.

a) configuration
   GCC 3.0 / SPARC / SOLARIS 8 / Thread model posix

b) to reproduce
   g++ -Wall -O2 -o bug bug.cpp

d) comments
   The example runs well when compiling in debug or with -O3. Note that
   if the Object destructor is NOT marked virtual, the program will
   run fine, even with O2. No include file is needed to reproduce.
	
c) example

   class Object {
   public:
              Object (void);
     virtual ~Object (void);
   };

   // create a new object
   Object::Object (void) {
   }

   // destroy this object
   Object::~Object (void) {
   }

   // this function throw the object
   static void lance (void) {
     throw Object ();
   }

   int main (int, char**) {   
     // try to catch the object
     try {
       lance ();
     } catch (...) {
       return 0;
     }
     return 1;
   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]