public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3768: GCC 3.0 fails to call destructors when expceptions thrown from try block
@ 2001-07-22 22:26 austin
  0 siblings, 0 replies; 2+ messages in thread
From: austin @ 2001-07-22 22:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3768
>Category:       c++
>Synopsis:       GCC 3.0 fails to call destructors when expceptions thrown from try block
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 22 22:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Austin Green
>Release:        gcc version 3.0
>Organization:
>Environment:
Solaris 8 on Intel Pentium
Full gcc -v output:
$ gcc -v
Reading specs from /opt/bin/gnu/../lib/gcc-lib/i386-pc-solaris2.8/3.0/specs
Configured with: ../gcc-3.0/configure --prefix=/opt/gnu --with-gnu-as --with-as=/opt/bin/gnu/as --with-gnu-ld --with-ld=/opt/bin/gnu/ld --with-gxx-include-dir=/opt/gnu/include/g++ --enable-threads=posix
Thread model: posix
gcc version 3.0
>Description:
When an exception is thrown from within a 'try' block, and not caught in the associated 'catch' block but propagated up to the calling function, the destructors of variables declared before the 'try' block are not called.
>How-To-Repeat:
Compile the small sample program attached.
Run it with no arguments for 'proper' behaviour.
Run it with any argument to show the fault.
>Fix:
No fix, but a work-around is as follows:
Surround the offending try/catch blocks and their preceding variable declarations with another try/catch block.  In this outer catch block, catch all exceptions and re-throw.
This is, in essence, what the compiler ought to be doing.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/3768: GCC 3.0 fails to call destructors when expceptions thrown from try block
@ 2001-08-03 17:04 rth
  0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2001-08-03 17:04 UTC (permalink / raw)
  To: austin, gcc-bugs, gcc-prs, nobody

Synopsis: GCC 3.0 fails to call destructors when expceptions thrown from try block

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Fri Aug  3 17:04:29 2001
State-Changed-Why:
    You didn't actually attach a test case, but the description is
    extremely similar to c++/3757.  If this is not the case, please
    file a new bug along with the test case.

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


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-22 22:26 c++/3768: GCC 3.0 fails to call destructors when expceptions thrown from try block austin
2001-08-03 17:04 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).