GCC Bugzilla – Attachment 46870 Details for
Bug 91737
On Alpine Linux (libmusl) a statically linked C++ program which throws the first exception in two threads at the same time can busy spin on shutdown after main().
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Program exposing the problem when compiled under Alpine Linux and linked statically.
exceptioncollision.cpp (text/x-csrc), 790 bytes, created by
Max Neunhöffer
on 2019-09-11 10:29:40 UTC
(
hide
)
Description:
Program exposing the problem when compiled under Alpine Linux and linked statically.
Filename:
MIME Type:
Creator:
Max Neunhöffer
Created:
2019-09-11 10:29:40 UTC
Size:
790 bytes
patch
obsolete
>// This program exposes a bug. Use alpine Linux and compile as follows: >// g++ exceptioncollision.cpp -o exceptioncollision -O0 -Wall -std=c++14 -lpthread -static >// Then execute the static executable multiple times: >// while true ; do ./exceptioncollision ; date ; done >// after a few tries it will freeze. > >#include <thread> >#include <atomic> >#include <chrono> > >std::atomic<int> letsgo{0}; > >void waiter() { > size_t count = 0; > while (letsgo == 0) { > ++count; > } > try { > throw 42; > } catch (int const& s) { > } >} > >int main(int, char*[]) { >#ifdef REPAIR > try { throw 42; } catch (int const& i) {} >#endif > std::thread t1(waiter); > std::thread t2(waiter); > std::this_thread::sleep_for(std::chrono::milliseconds(10)); > letsgo = 1; > t1.join(); > t2.join(); > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 91737
: 46870