[PATCH] D81830: [compiler-rt] Fix intermittent failure with instrprof-gcov-multithread_fork.test on 32-bit arm

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 02:41:33 PDT 2020


rovka created this revision.
rovka added a reviewer: calixte.
Herald added subscribers: danielkiss, kristof.beyls, dberris.
rovka added a comment.

@calixte: Does this affect the intention of the test in any way?


The test fails intermittently with 'terminate called recursively' errors likely 
caused by having too many threads. This patch addresses the issue by
catching any exceptions thrown during thread creation.


https://reviews.llvm.org/D81830

Files:
  compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp


Index: compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp
===================================================================
--- compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp
+++ compiler-rt/test/profile/Inputs/instrprof-gcov-multithread_fork.cpp
@@ -8,28 +8,31 @@
   std::vector<std::thread> pool;

   for (int i = 0; i < 10; i++) {
-     pool.emplace_back(std::thread(func));
+    try {
+      pool.emplace_back(std::thread(func));
+    } catch (...) {
+    }
   }

   for (auto &t : pool) {
     t.join();
   }
 }

 void h() {}

 void g() {
   fork();
   launcher<>(h);
 }

 void f() {
   fork();
   launcher<>(g);
 }

 int main() {
   launcher<>(f);

   return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81830.270690.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200615/0fdfb667/attachment.bin>


More information about the llvm-commits mailing list