[Development] thread_local: replacing GCC with Clang for MinGW

Thiago Macieira thiago.macieira at intel.com
Sat Aug 24 18:04:14 CEST 2019

On Friday, 23 August 2019 11:16:29 PDT Thiago Macieira wrote:
> Simon wrote:
> > I ran into the crash a while ago in the CI. See also
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562 .
> That bug report shows that GCC does not properly implement thread_local on
> MinGW 32-bit over 8 years after the publication of the standard and over 4
> years after the feature became available on other platforms.


Looks like Android suffers from the same __emutls bug until Android M:

And looking at the assembly generated by Clang 10 on Windows, it's not right 

That means we have two major platforms failing to properly implement a C++11 
feature over 8 years after the standard. That means we must continue to use 
QThreadStorage where we need non-POD thread-local storage, which only works[*] 
in QThread-started threads.

[*] it won't crash if you use QThreadStorage with a thread started with 
something else, despite what the source code says, but it will leak memory.
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products

More information about the Development mailing list