externs and thread local storage

Dave Korn dave.korn@artimi.com
Sun Jul 2 12:00:00 GMT 2006


On 02 July 2006 08:15, Seongbae Park wrote:

> On 7/1/06, Gary Funck <gary@intrepid.com> wrote:
> ...
>> What are the technical reasons for the front-end enforcing this
>> restriction, when apparently some linkers will handle the TLS linkage
>> fine?  If in fact it is required that __thread be added to the extern, is
>> the compiler simply accommodating a limitation/bug in the linker?
> 
> Because the compiler has to generate different code
> for accesses to __thread vs non __thread variable:

  Reasons like this are why we have 6.2.7.2 in the C language spec, aren't
they?

"All declarations that refer to the same object or function shall have
compatible type; otherwise, the behavior is undefined. "

  Perhaps we should regard __thread as being like a type-qualifier of some
kind?  

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....



More information about the Gcc mailing list