public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3719: Unable to retrow exception in unexpected exception handler.
@ 2001-07-17 14:26 Edward Maros
  0 siblings, 0 replies; 4+ messages in thread
From: Edward Maros @ 2001-07-17 14:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3719
>Category:       c++
>Synopsis:       Unable to retrow exception in unexpected exception handler.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 17 14:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Edward Maros
>Release:        3.0
>Organization:
>Environment:
System: Linux localhost 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/ldcg/gcc-3.0-toolset --with-local-prefix=/ldcg/gcc-3.0-toolset --with-gnu-ld=/ldcg/gcc-3.0-toolset/bin/ld --with-gnu-as=/ldcg/gcc-3.0-toolset/bin/as --enable-shared --enable-threads=posix
>Description:
When rethrowing an exception from within an exception handler, a segfault occurs.
>How-To-Repeat:
#include <iostream>
#include <stdexcept>


//
// Extended bad_exception class with info on exception no handled in the
// throw specifier
//
class unhandled: public std::bad_exception
{
public:
  unhandled( const std::string& what )
    : m_what( what )
  {
  }

  ~unhandled() throw() {}

  virtual const char*
  what() const throw()
  {
    return m_what.c_str();
  }

private:
  std::string m_what;
};

//
// New handler for unexpected exceptions
//

void
handle_unexpected( void )
{
  try {
    throw;
  }
  catch( std::bad_alloc )
  {
    throw unhandled( "bad_alloc" );
  }
}

//
// No problem
//

void
c1( void ) throw ( std::bad_alloc )
{
  throw std::bad_alloc();
}

//
// No problem
//

void
c2( void )
{
  throw std::bad_alloc();
}

//
// Problem do to bad_alloc not being in throw specification
//

void
c3( void ) throw ( std::bad_exception )
{
  throw std::bad_alloc();
}

main()
{
  std::set_unexpected( handle_unexpected );
  try {
    c1();
  }
  catch ( const std::bad_alloc& e )
  {
    std::cerr << "Caught exception for c1" << std::endl;
  }

  try {
    c2();
  }
  catch ( const std::bad_alloc& e )
  {
    std::cerr << "Caught exception for c2" << std::endl;
  }

  try {
    c3();
  }
  catch ( const std::bad_alloc& e )
  {
    std::cerr << "Caught exception for c3" << std::endl;
  }
  catch ( const std::bad_exception& e )
  {
    std::cerr << "Caught bad_exception for c3" << e.what() << std::endl;
  }

}

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/3719: Unable to retrow exception in unexpected exception handler.
@ 2002-03-30 19:16 rth
  0 siblings, 0 replies; 4+ messages in thread
From: rth @ 2002-03-30 19:16 UTC (permalink / raw)
  To: efm, gcc-bugs, gcc-prs, rth

Synopsis: Unable to retrow exception in unexpected exception handler.

State-Changed-From-To: analyzed->closed
State-Changed-By: rth
State-Changed-When: Sat Mar 30 19:16:02 2002
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2002-03/msg02076.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3719


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

* Re: c++/3719: Unable to retrow exception in unexpected exception handler.
@ 2002-03-30 17:35 rth
  0 siblings, 0 replies; 4+ messages in thread
From: rth @ 2002-03-30 17:35 UTC (permalink / raw)
  To: efm, gcc-bugs, gcc-prs, nobody, rth

Synopsis: Unable to retrow exception in unexpected exception handler.

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Sat Mar 30 17:35:39 2002
Responsible-Changed-Why:
    .

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3719


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

* Re: c++/3719: Unable to retrow exception in unexpected exception handler.
@ 2002-03-24  9:10 nathan
  0 siblings, 0 replies; 4+ messages in thread
From: nathan @ 2002-03-24  9:10 UTC (permalink / raw)
  To: efm, gcc-bugs, gcc-prs, nobody

Synopsis: Unable to retrow exception in unexpected exception handler.

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Sun Mar 24 09:10:00 2002
State-Changed-Why:
    confirmed, a 2.95 regression still present in 3.1 branch

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3719


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

end of thread, other threads:[~2002-03-31  3:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-17 14:26 c++/3719: Unable to retrow exception in unexpected exception handler Edward Maros
2002-03-24  9:10 nathan
2002-03-30 17:35 rth
2002-03-30 19:16 rth

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