public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
@ 2004-05-26 23:56 rajanba at nortelnetworks dot com
  2004-05-27  3:50 ` [Bug target/15662] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rajanba at nortelnetworks dot com @ 2004-05-26 23:56 UTC (permalink / raw)
  To: gcc-bugs

Consider the following:

#include <iostream.h>


class Exception{
  public:
    Exception() {}
    ~Exception() {}
};

std::string foo(bool throwException)
{
   if( throwException ) {
     throw Exception();
   } else {
     std:: string x = "hello world";
     return x;
  }
}

int main(int argc, char** argv)
{
  try {
    const std::string & str  = foo(true);
  } catch(...) {
    cout << "Caught an exception" << endl;
  }
  return 0;
}

Compiled it for POWERPC target and upon execution, it segmentation faults and 
dumps a core. From the core, it is trying to delete the std::string object 
pointed at by str (reference to string to be returned from foo) while unwinding 
the stack.

The same results are obtained if any of the STL classes are used. 

Everything works fine on x86 targets. 


It seems that the gcc compiler is breaching  ISO/ISE 14882:2003 12.2/5 upon 
throw of an exception.

Thanks

-- 
           Summary: Segmentation fault (POWERPC ) when an exception is
                    thrown - even if try catch is specified
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rajanba at nortelnetworks dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-06-10 13:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
2004-05-27  3:50 ` [Bug target/15662] " pinskia at gcc dot gnu dot org
2004-05-27  4:33 ` pinskia at gcc dot gnu dot org
2004-05-27  5:09 ` bangerth at dealii dot org
2004-05-27  7:45 ` rajanba at nortelnetworks dot com
2004-05-27  8:51 ` pinskia at gcc dot gnu dot org
2004-05-27  9:24 ` bangerth at dealii dot org
2004-06-10 12:24 ` amodra at bigpond dot net dot au
2004-06-10 13:07 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).