Skip to content

Commit

Permalink
Avoid thread_local on current or older MinGW.
Browse files Browse the repository at this point in the history
This is for jtv#453.  Turns out MinGW gcc's current `thread_local`
implementation breaks _at runtime._  So a simple compilation check won't
detect the problem, but it's a serious bug, reportedly fixed in gcc 11.

I'll still need to re-generate the configure script etc.  But I'll do
that in a separate commit.
  • Loading branch information
jtv committed Jun 10, 2021
1 parent 7d0913a commit c9321aa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config-tests/thread_local.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

int main(int argc, char **)
{
#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 11
#error "This MinGW gcc's thread_local breaks at run time, sorry."
#endif
thread_local std::stringstream s;
s << argc;
std::cout << s.str();
Expand Down

0 comments on commit c9321aa

Please sign in to comment.