Accepting request 927298 from home:llansky3:branches:devel:gcc
PR libstdc++/55917 do not handle exceptions in std::thread (jsc#CAR-1182) OBS-URL: https://build.opensuse.org/request/show/927298 OBS-URL: https://build.opensuse.org/package/show/devel:gcc/gcc7?expand=0&rev=217
This commit is contained in:
parent
71e9f2c29d
commit
2d282e2c26
117
gcc7-pr55917.patch
Normal file
117
gcc7-pr55917.patch
Normal file
@ -0,0 +1,117 @@
|
||||
From 754d67d5ba4a1f9994210d402893a4cf49ce6a71 Mon Sep 17 00:00:00 2001
|
||||
From: Jonathan Wakely <jwakely@redhat.com>
|
||||
Date: Mon, 12 Jun 2017 17:37:28 +0100
|
||||
Subject: [PATCH] PR libstdc++/55917 do not handle exceptions in std::thread
|
||||
|
||||
PR libstdc++/55917
|
||||
* src/c++11/thread.cc (execute_native_thread_routine): Remove
|
||||
try-block so that exceptions propagate out of the thread and terminate
|
||||
is called by the exception-handling runtime.
|
||||
(execute_native_thread_routine_compat): Likewise.
|
||||
* testsuite/30_threads/thread/cons/terminate.cc: New.
|
||||
|
||||
diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc
|
||||
index 44a230a708e..4a94bdd2f8c 100644
|
||||
--- a/libstdc++-v3/src/c++11/thread.cc
|
||||
+++ b/libstdc++-v3/src/c++11/thread.cc
|
||||
@@ -77,20 +77,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
|
||||
execute_native_thread_routine(void* __p)
|
||||
{
|
||||
thread::_State_ptr __t{ static_cast<thread::_State*>(__p) };
|
||||
-
|
||||
- __try
|
||||
- {
|
||||
- __t->_M_run();
|
||||
- }
|
||||
- __catch(const __cxxabiv1::__forced_unwind&)
|
||||
- {
|
||||
- __throw_exception_again;
|
||||
- }
|
||||
- __catch(...)
|
||||
- {
|
||||
- std::terminate();
|
||||
- }
|
||||
-
|
||||
+ __t->_M_run();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -104,20 +91,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
|
||||
// the thread state to a local object, breaking the reference cycle
|
||||
// created in thread::_M_start_thread.
|
||||
__local.swap(__t->_M_this_ptr);
|
||||
-
|
||||
- __try
|
||||
- {
|
||||
- __t->_M_run();
|
||||
- }
|
||||
- __catch(const __cxxabiv1::__forced_unwind&)
|
||||
- {
|
||||
- __throw_exception_again;
|
||||
- }
|
||||
- __catch(...)
|
||||
- {
|
||||
- std::terminate();
|
||||
- }
|
||||
-
|
||||
+ __t->_M_run();
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
|
||||
new file mode 100644
|
||||
index 00000000000..4b35b6c6024
|
||||
--- /dev/null
|
||||
+++ b/libstdc++-v3/testsuite/30_threads/thread/cons/terminate.cc
|
||||
@@ -0,0 +1,48 @@
|
||||
+// Copyright (C) 2017 Free Software Foundation, Inc.
|
||||
+//
|
||||
+// This file is part of the GNU ISO C++ Library. This library is free
|
||||
+// software; you can redistribute it and/or modify it under the
|
||||
+// terms of the GNU General Public License as published by the
|
||||
+// Free Software Foundation; either version 3, or (at your option)
|
||||
+// any later version.
|
||||
+
|
||||
+// This library is distributed in the hope that it will be useful,
|
||||
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+// GNU General Public License for more details.
|
||||
+
|
||||
+// You should have received a copy of the GNU General Public License along
|
||||
+// with this library; see the file COPYING3. If not see
|
||||
+// <http://www.gnu.org/licenses/>.
|
||||
+
|
||||
+// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } }
|
||||
+// { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* powerpc-ibm-aix* } }
|
||||
+// { dg-require-effective-target c++11 }
|
||||
+// { dg-require-cstdint "" }
|
||||
+// { dg-require-gthreads "" }
|
||||
+
|
||||
+#include <thread>
|
||||
+#include <exception>
|
||||
+#include <cstdlib>
|
||||
+
|
||||
+void handle_terminate()
|
||||
+{
|
||||
+ std::_Exit(0);
|
||||
+}
|
||||
+
|
||||
+void f() { throw 1; }
|
||||
+
|
||||
+void
|
||||
+test01()
|
||||
+{
|
||||
+ std::set_terminate(handle_terminate);
|
||||
+ std::thread t(f);
|
||||
+ t.join();
|
||||
+ std::abort();
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+main()
|
||||
+{
|
||||
+ test01();
|
||||
+}
|
||||
--
|
||||
2.27.0
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 25 11:40:00 UTC 2021 - Lukas Lansky <lukas.lansky@suse.com>
|
||||
|
||||
- Add gcc7-pr55917.patch to do not handle exceptions in std::thread
|
||||
(jsc#CAR-1182)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 20 16:52:20 UTC 2021 - Giuliano Belinassi <giuliano.belinassi@suse.com>
|
||||
|
||||
|
@ -319,6 +319,7 @@ Patch31: gcc7-testsuite-fixes.patch
|
||||
Patch32: gcc7-pr81942.patch
|
||||
Patch33: gcc7-sanitizer-cyclades.patch
|
||||
Patch34: gcc7-ada-MINSTKSZ.patch
|
||||
Patch35: gcc7-pr55917.patch
|
||||
# A set of patches from the RH srpm
|
||||
Patch51: gcc41-ppc32-retaddr.patch
|
||||
# Some patches taken from Debian
|
||||
@ -1813,6 +1814,7 @@ ln -s nvptx-newlib/newlib .
|
||||
%patch32 -p1
|
||||
%patch33 -p1
|
||||
%patch34 -p1
|
||||
%patch35 -p1
|
||||
%patch51
|
||||
%patch60
|
||||
%patch61
|
||||
|
Loading…
x
Reference in New Issue
Block a user