public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/3775: dtor of auto variable outside a try loop is not called in exception unwinding
@ 2001-08-03 17:02 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2001-08-03 17:02 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, sll

Synopsis: dtor of auto variable outside a try loop is not called in exception unwinding

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Fri Aug  3 17:02:35 2001
State-Changed-Why:
    Duplicate of c++/3757.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3775&database=gcc


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

* c++/3775: dtor of auto variable outside a try loop is not called in exception unwinding
@ 2001-07-23  8:16 sll
  0 siblings, 0 replies; 2+ messages in thread
From: sll @ 2001-07-23  8:16 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3775
>Category:       c++
>Synopsis:       dtor of auto variable outside a try loop is not called in exception unwinding
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 23 08:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Sai Lai Lo
>Release:        3.0
>Organization:
AT&T Laboratories- Cambridge
>Environment:
System: Linux neem.uk.research.att.com 2.4.6patched #2 SMP Tue Jul 10 14:32:14 BST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/usr/local/gcc --enable-threads=posix --enable-languages=c++
>Description:
The dtor of an auto variable outside a try loop is not called when an 
uncaught exception inside the try loop unwinds.
>How-To-Repeat:
This simple test code can reproduce the problem.
The output should be:

A()
~A()
Got long 0

Instead the output is

A()
Got long 0


------
#include <iostream.h>

class A {
public:
  A() {
    cerr << "A()" << endl;
  }

  ~A() {
    cerr << "~A()" << endl;
  }
 
};
 
void f() {
  A a;
 
  try {
    throw long(0);
  }
  catch(int&) {
    cerr << "Got int exception" << endl;
  }
}
 
 
int
main(int,char**) {
  try {
    f();
  }
  catch(long& v) {
    cerr << "Got long " << v << endl;
  }
  return 0;
}
-------
 
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2001-08-03 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-03 17:02 c++/3775: dtor of auto variable outside a try loop is not called in exception unwinding rth
  -- strict thread matches above, loose matches on Subject: below --
2001-07-23  8:16 sll

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