Blame SOURCES/gcc48-pr62258.patch

4dd737
2015-09-03  Jonathan Wakely  <jwakely@redhat.com>
4dd737
4dd737
	Backport from mainline
4dd737
	2015-04-27  Dmitry Prokoptsev  <dprokoptsev@gmail.com>
4dd737
		    Michael Hanselmann  <public@hansmi.ch>
4dd737
4dd737
	PR libstdc++/62258
4dd737
	* libsupc++/eh_ptr.cc (rethrow_exception): Increment count of
4dd737
	uncaught exceptions.
4dd737
	* testsuite/18_support/exception_ptr/62258.cc: New.
4dd737
4dd737
--- libstdc++-v3/libsupc++/eh_ptr.cc	(revision 227455)
4dd737
+++ libstdc++-v3/libsupc++/eh_ptr.cc	(revision 227456)
4dd737
@@ -245,6 +245,9 @@ std::rethrow_exception(std::exception_pt
4dd737
   __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(dep->unwindHeader.exception_class);
4dd737
   dep->unwindHeader.exception_cleanup = __gxx_dependent_exception_cleanup;
4dd737
 
4dd737
+  __cxa_eh_globals *globals = __cxa_get_globals ();
4dd737
+  globals->uncaughtExceptions += 1;
4dd737
+
4dd737
 #ifdef _GLIBCXX_SJLJ_EXCEPTIONS
4dd737
   _Unwind_SjLj_RaiseException (&dep->unwindHeader);
4dd737
 #else
4dd737
--- libstdc++-v3/testsuite/18_support/exception_ptr/62258.cc	(revision 0)
4dd737
+++ libstdc++-v3/testsuite/18_support/exception_ptr/62258.cc	(revision 227456)
4dd737
@@ -0,0 +1,61 @@
4dd737
+// { dg-options "-std=gnu++11" }
4dd737
+// { dg-require-atomic-builtins "" }
4dd737
+
4dd737
+// Copyright (C) 2015 Free Software Foundation, Inc.
4dd737
+//
4dd737
+// This file is part of the GNU ISO C++ Library.  This library is free
4dd737
+// software; you can redistribute it and/or modify it under the
4dd737
+// terms of the GNU General Public License as published by the
4dd737
+// Free Software Foundation; either version 3, or (at your option)
4dd737
+// any later version.
4dd737
+
4dd737
+// This library is distributed in the hope that it will be useful,
4dd737
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
4dd737
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4dd737
+// GNU General Public License for more details.
4dd737
+
4dd737
+// You should have received a copy of the GNU General Public License along
4dd737
+// with this library; see the file COPYING3.  If not see
4dd737
+// <http://www.gnu.org/licenses/>.
4dd737
+
4dd737
+// PR libstdc++/62258
4dd737
+
4dd737
+#include <exception>
4dd737
+#include <testsuite_hooks.h>
4dd737
+
4dd737
+struct check_on_destruct
4dd737
+{
4dd737
+  ~check_on_destruct();
4dd737
+};
4dd737
+
4dd737
+check_on_destruct::~check_on_destruct()
4dd737
+{
4dd737
+  VERIFY(std::uncaught_exception());
4dd737
+}
4dd737
+
4dd737
+int main ()
4dd737
+{
4dd737
+  VERIFY(!std::uncaught_exception());
4dd737
+
4dd737
+  try
4dd737
+    {
4dd737
+      check_on_destruct check;
4dd737
+
4dd737
+      try
4dd737
+        {
4dd737
+          throw 1;
4dd737
+        }
4dd737
+      catch (...)
4dd737
+        {
4dd737
+          VERIFY(!std::uncaught_exception());
4dd737
+
4dd737
+          std::rethrow_exception(std::current_exception());
4dd737
+        }
4dd737
+    }
4dd737
+  catch (...)
4dd737
+    {
4dd737
+      VERIFY(!std::uncaught_exception());
4dd737
+    }
4dd737
+
4dd737
+  VERIFY(!std::uncaught_exception());
4dd737
+}