Quantcast
Channel: Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1616

Bug/Limitation: Cannot compile thread_local dynamic non-POD object for MIC architecture (c++11)

$
0
0

Hello,

we are having an issue compiling c++ code using the thread_local feature from  c++11 standard  for non-POD types. The same code compiles without problems for the host architecture, but it cannot compile for MIC architecture.

These are the relevant lines from a unit test that will not compile for MIC:

// [...]
  defaults& theDefaults() {
    static thread_local A anA;
    static thread_local B aB;
    static thread_local defaults theDefaults(anA,aB);
    return theDefaults;
  }
// [...]

While for the host architecture the code compiles, for mic (e.g. adding -mmic) the compilation fails. A warning is emitted during compilation of the unit:

warning #1897: thread-local variable cannot be dynamically initialized

And at link-time the following error is emitted:

testme.cc:(.text+0x2af): undefined reference to `__cxa_thread_atexit'

Is there a solution to this problem? What is the origin of it?

A complete unit test that shows the problem can be found here and is attached to this thread:

https://github.com/andreadotti/thread_local-Test-ICC

Thank you,

Andrea Dotti

AdjuntoTamaño
Descargarunit-test.tgz779 bytes

Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>