This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/53906] New: Runtime crash on ARM linux when using std::thread


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53906

             Bug #: 53906
           Summary: Runtime crash on ARM linux when using std::thread
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cascaval@qualcomm.com


Using the following simple test on an ARM linux platform with gcc 4.7.1 and
-march=armv7-a results in a crash.

Here is the example:

#include <iostream>
#include <thread>
#include <vector>

using namespace std;

void worker(int tid) { cout << "Running in thread " << tid << endl; }

int main() {
  int nThreads = 4;
  vector<thread> threads;

  for (int i = 0; i < nThreads; ++i)
    threads.push_back(thread(worker, i));

  for(auto &t : threads) t.join();

  return 0;
}

Compiling with gcc-4.7:
/opt/local/bin/gcc-4.7 -v
Using built-in specs.
COLLECT_GCC=gcc-4.7
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/armv7l-unknown-linux-gnueabi/4.7.1/lto-wrapper
Target: armv7l-unknown-linux-gnueabi
Configured with: /tmp/src/gcc/gcc-4.7.1/configure --prefix=/opt/local
--program-suffix=-4.7 --enable-shared --disable-nls --with-system-zlib
--enable-threads=posix --enable-tls --enable-plugin --enable-lto
--enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: posix
gcc version 4.7.1 (GCC)

Platform: ARM Cortex A9, Linux 3.3.0 kernel

Here is the output when compiled with the default arch:
prompt> /opt/local/bin/g++-4.7 -std=c++11 -ggdb -pthread threadtest.cc -o
t_armv5            
prompt> ./t_armv5
Running in thread 2
Running in thread 0
Running in thread 1
Running in thread 3

And when compiled with the additional -march=armv7-a
prompt> /opt/local/bin/g++-4.7 -march=armv7-a -std=c++11 -ggdb -pthread
threadtest.cc -o t_armv7
prompt> ./t_armv7
pure virtual method called
pure virtual method called
pure virtual method called
terminate called without an active exception
terminate called recursively
Abort (core dumped)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]