aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-02-08 10:01:23 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-02-08 10:01:23 -0800
commitc38628062d37af9bbf6478eaf9f0568c0e156eff (patch)
treecc7b028fb0b5dddd6aa536778874ae7ce1806b33
parentfb1b37c797ac31dbabfa627ccbbedd51006333ea (diff)
downloadgcc-c38628062d37af9bbf6478eaf9f0568c0e156eff.zip
gcc-c38628062d37af9bbf6478eaf9f0568c0e156eff.tar.gz
gcc-c38628062d37af9bbf6478eaf9f0568c0e156eff.tar.bz2
re PR libstdc++/14026 (std::uncaught_exception is true although there are no uncaught exceptions (rethrow, ghost exception))
PR libstdc++/14026 * libsupc++/eh_catch.cc (__cxa_begin_catch): Don't adjust uncaughtExceptions during nested catch rethrow. * testsuite/18_support/14026.cc: New. From-SVN: r77492
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/libsupc++/eh_catch.cc8
-rw-r--r--libstdc++-v3/testsuite/18_support/14026.cc34
3 files changed, 46 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a8a0edc..4da5edd 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-08 Richard Henderson <rth@redhat.com>
+
+ PR libstdc++/14026
+ * libsupc++/eh_catch.cc (__cxa_begin_catch): Don't adjust
+ uncaughtExceptions during nested catch rethrow.
+ * testsuite/18_support/14026.cc: New.
+
2004-02-08 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.tcc (assign(const _CharT*, size_type)):
diff --git a/libstdc++-v3/libsupc++/eh_catch.cc b/libstdc++-v3/libsupc++/eh_catch.cc
index f8b7137..0e18660 100644
--- a/libstdc++-v3/libsupc++/eh_catch.cc
+++ b/libstdc++-v3/libsupc++/eh_catch.cc
@@ -1,5 +1,5 @@
// -*- C++ -*- Exception handling routines for catching.
-// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
//
// This file is part of GCC.
//
@@ -65,10 +65,12 @@ __cxa_begin_catch (void *exc_obj_in)
// This exception was rethrown from an immediately enclosing region.
count = -count + 1;
else
- count += 1;
+ {
+ count += 1;
+ globals->uncaughtExceptions -= 1;
+ }
header->handlerCount = count;
- globals->uncaughtExceptions -= 1;
if (header != prev)
{
header->nextException = prev;
diff --git a/libstdc++-v3/testsuite/18_support/14026.cc b/libstdc++-v3/testsuite/18_support/14026.cc
new file mode 100644
index 0000000..103ac64
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/14026.cc
@@ -0,0 +1,34 @@
+// PR 14026
+// 18.6.4 uncaught_exception
+
+#include <cstdlib>
+#include <exception>
+#include <testsuite_hooks.h>
+
+static void
+no_uncaught ()
+{
+ if (std::uncaught_exception ())
+ abort ();
+}
+
+int
+main ()
+{
+ try
+ {
+ throw 1;
+ }
+ catch (...)
+ {
+ try
+ {
+ throw;
+ }
+ catch (...)
+ {
+ no_uncaught ();
+ }
+ }
+ no_uncaught ();
+}