public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43365]  New: [4.5 Regression] Destructor not called when returning in exception handler
@ 2010-03-14 13:55 erik at ejohansson dot se
  2010-03-14 13:58 ` [Bug c++/43365] " erik at ejohansson dot se
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: erik at ejohansson dot se @ 2010-03-14 13:55 UTC (permalink / raw)
  To: gcc-bugs

When returning from a function in an exception handler, the destructor for
objects local to the function is never called.

The attached program returns 0 (as expected) when compiled with:
gcc version 4.4.3 (Debian 4.4.3-3)

The same program returns 1 when compiled with:
gcc version 4.5.0 20100310 (experimental) [trunk revision 157334] (Debian
20100310-1)

Configured with: ../src/configure -v --with-pkgversion='Debian 20100310-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,java,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --enable-shared --enable-multiarch
--enable-linker-build-id --with-system-zlib --disable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-plugin --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.5-snap/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.5-snap
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.5-snap
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --with-arch-32=i486 --with-tune=generic --disable-werror
--enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu


-- 
           Summary: [4.5 Regression] Destructor not called when returning in
                    exception handler
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: erik at ejohansson dot se
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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


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

* [Bug c++/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
@ 2010-03-14 13:58 ` erik at ejohansson dot se
  2010-03-14 17:27 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: erik at ejohansson dot se @ 2010-03-14 13:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from erik at ejohansson dot se  2010-03-14 13:57 -------
Created an attachment (id=20103)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20103&action=view)
Sample code that triggers the error

With gcc 4.4.3:
/usr/bin/g++ -o exception exception.cc && ./exception; echo $?
0

With gcc 4.5.0:
/usr/lib/gcc-snapshot/bin/g++ -o exception exception.cc && ./exception; echo $?
1


-- 


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


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

* [Bug c++/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
  2010-03-14 13:58 ` [Bug c++/43365] " erik at ejohansson dot se
@ 2010-03-14 17:27 ` hjl dot tools at gmail dot com
  2010-03-15 10:39 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-03-14 17:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-03-14 17:27 -------
It is caused by revision 151696:

http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00443.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-14 17:27:20
               date|                            |


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


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

* [Bug c++/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
  2010-03-14 13:58 ` [Bug c++/43365] " erik at ejohansson dot se
  2010-03-14 17:27 ` hjl dot tools at gmail dot com
@ 2010-03-15 10:39 ` rguenth at gcc dot gnu dot org
  2010-03-15 13:14 ` [Bug middle-end/43365] " rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-15 10:39 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Target Milestone|---                         |4.5.0


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


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

* [Bug middle-end/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
                   ` (2 preceding siblings ...)
  2010-03-15 10:39 ` rguenth at gcc dot gnu dot org
@ 2010-03-15 13:14 ` rguenth at gcc dot gnu dot org
  2010-03-15 18:53 ` rth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-15 13:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-03-15 13:13 -------
Or is a latent bug in ehopt.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org
          Component|c++                         |middle-end
           Priority|P3                          |P1


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


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

* [Bug middle-end/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
                   ` (3 preceding siblings ...)
  2010-03-15 13:14 ` [Bug middle-end/43365] " rguenth at gcc dot gnu dot org
@ 2010-03-15 18:53 ` rth at gcc dot gnu dot org
  2010-03-16 23:03 ` rth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2010-03-15 18:53 UTC (permalink / raw)
  To: gcc-bugs



-- 

rth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rth at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-03-14 17:27:20         |2010-03-15 18:53:26
               date|                            |


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


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

* [Bug middle-end/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
                   ` (4 preceding siblings ...)
  2010-03-15 18:53 ` rth at gcc dot gnu dot org
@ 2010-03-16 23:03 ` rth at gcc dot gnu dot org
  2010-03-17 15:24 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rth at gcc dot gnu dot org @ 2010-03-16 23:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rth at gcc dot gnu dot org  2010-03-16 23:02 -------
Subject: Bug 43365

Author: rth
Date: Tue Mar 16 23:02:35 2010
New Revision: 157499

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157499
Log:
        PR middle-end/43365
        * tree-eh.c (replace_goto_queue): Also replace in the eh_seq.
        (lower_try_finally): Save and restore eh_seq around the expansion
        of the try-finally.

Added:
    trunk/gcc/testsuite/g++.dg/eh/pr43365.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-eh.c


-- 


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


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

* [Bug middle-end/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
                   ` (5 preceding siblings ...)
  2010-03-16 23:03 ` rth at gcc dot gnu dot org
@ 2010-03-17 15:24 ` rguenth at gcc dot gnu dot org
  2010-04-12 20:50 ` erik at ejohansson dot se
  2010-06-14  6:58 ` ian at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-03-17 15:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-03-17 15:24 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug middle-end/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
                   ` (6 preceding siblings ...)
  2010-03-17 15:24 ` rguenth at gcc dot gnu dot org
@ 2010-04-12 20:50 ` erik at ejohansson dot se
  2010-06-14  6:58 ` ian at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: erik at ejohansson dot se @ 2010-04-12 20:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from erik at ejohansson dot se  2010-04-12 20:50 -------
Tested with latest Debian gcc-snapshot on the code where I originally saw the
problem and it works now. Thank you very much.

Tested with:
gcc (Debian 20100408-1) 4.5.0 20100408 (prerelease) [gcc-4_5-branch revision
158131]


-- 

erik at ejohansson dot se changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED


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


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

* [Bug middle-end/43365] [4.5 Regression] Destructor not called when returning in exception handler
  2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
                   ` (7 preceding siblings ...)
  2010-04-12 20:50 ` erik at ejohansson dot se
@ 2010-06-14  6:58 ` ian at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ian at gcc dot gnu dot org @ 2010-06-14  6:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ian at gcc dot gnu dot org  2010-06-14 06:57 -------
Subject: Bug 43365

Author: ian
Date: Mon Jun 14 06:57:36 2010
New Revision: 160704

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160704
Log:
Avoid crash when exception landing pad becomes unreachable.

Bring over trunk patch for PR 43365.

Modified:
    branches/gccgo/gcc/tree-eh.c


-- 


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


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

end of thread, other threads:[~2010-06-14  6:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-14 13:55 [Bug c++/43365] New: [4.5 Regression] Destructor not called when returning in exception handler erik at ejohansson dot se
2010-03-14 13:58 ` [Bug c++/43365] " erik at ejohansson dot se
2010-03-14 17:27 ` hjl dot tools at gmail dot com
2010-03-15 10:39 ` rguenth at gcc dot gnu dot org
2010-03-15 13:14 ` [Bug middle-end/43365] " rguenth at gcc dot gnu dot org
2010-03-15 18:53 ` rth at gcc dot gnu dot org
2010-03-16 23:03 ` rth at gcc dot gnu dot org
2010-03-17 15:24 ` rguenth at gcc dot gnu dot org
2010-04-12 20:50 ` erik at ejohansson dot se
2010-06-14  6:58 ` ian 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).