[LLVMbugs] [Bug 23428] New: Aarch64: libstdc++ std::thread, when compiled with clang, "pure virtual method called"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 6 00:43:12 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23428

            Bug ID: 23428
           Summary: Aarch64: libstdc++ std::thread, when compiled with
                    clang, "pure virtual method called"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: danilo.piparo at cern.ch
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

cat stdthreadbug.cpp
#include <thread>

int main()
{
   std::thread t([](){});
   t.join();
}

$clang++ -v
clang version 3.7.0 (trunk 236571) (llvm/trunk 236570)
Target: aarch64-unknown-linux-gnu
Thread model: posix

$clang++ -std=c++11 -pthread stdthreadbug.cpp -o stdthreadbug 

$./stdthreadbug 
pure virtual method called
terminate called without an active exception
Aborted

Note that this works:

cat stdthreadbugkludge.cpp
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8

#include <thread>

int main()
{
   std::thread t([](){});
   t.join();
}

One of the many ways in which one might fix this is the following:

Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp       (revision 236571)
+++ lib/Basic/Targets.cpp       (working copy)
@@ -4926,6 +4926,11 @@

     if (Crypto)
       Builder.defineMacro("__ARM_FEATURE_CRYPTO");
+
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
+    Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
   }

   void getTargetBuiltins(const Builtin::Info *&Records,

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150506/07a58688/attachment.html>


More information about the llvm-bugs mailing list