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
Created attachment 20103 [details] 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
It is caused by revision 151696: http://gcc.gnu.org/ml/gcc-cvs/2009-09/msg00443.html
Or is a latent bug in ehopt.
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
Fixed.
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]
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