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