externs and thread local storage

Andrew Pinski pinskia@physics.uc.edu
Sun Jul 2 21:13:00 GMT 2006


On Jul 2, 2006, at 1:58 PM, Gary Funck wrote:
> The fact that one current generally available platform doesn't require
> the __thread attribute on the extern should be enough to at least
> question whether an *error* should be diagnosed.  Also, consider
> that compiler can't check for consistency across separately linked
> files and the linker already will give an error if references to
> __thread local objects don't have thread lcoal relocations.

What about the following two sources:

char t;

---
extern int t;


What should happen? According to the C standard this is invalid code but
the compiler does not need to diagnose the problem.

-- Pinski



More information about the Gcc mailing list