https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769

--- Comment #9 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Vincent Lefèvre from comment #8)
> (In reply to Florian Weimer from comment #7)
> > Furthermore, if I don't misread the standard, the expectation is that if an
> > implementation does not support threads, it still recognizes _Thread_local
> > and mostly ignores it,
> 
> I suppose that the goal is to be able to compile multithread-aware programs
> on platforms that do not support threads. Since there is only one thread,
> thread storage duration is equivalent to static storage duration.

Exactly.

> > so that it is available even if __STDC_NO_THREADS__
> > is not defined.  (Which is of course rather dodgy if you need to conform to
> > an existing ABI for thread-local variables, so I think the committee made a
> > mistake here.)
> 
> The ABI is out of the scope of the standard, so that I don't see any issue
> here. The conformance to the existing ABI is something above the standard.

But we still have the issue for compilers targeting an ABI which has threads
and full thread-local support but which themselves do not support it.  They
really should not treat _Thread_local as static storage duration because that
would either produce object files which fail to link, or silently corrupt
programs (which may even work most of the time).

Reply via email to