http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49316
Graham Reed <greed at pobox dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |greed at pobox dot com --- Comment #2 from Graham Reed <greed at pobox dot com> 2011-10-25 20:04:32 UTC --- This may be the same fault I'm seeing on AIX with GCC 4.6.1--does Tru64 use an "emulated TLS" as well? I reduced diag-1.C to this: template <typename T> struct B { static __thread T t; }; template <typename T> __thread T B<T>::t = 42; void bar () { int j = B<int>::t; } If it is the same fault, what's happening is, a weak, public reference is being created for the TLS emulation template for B<int>::t. When it is used to initialize j, the public flag is cleared--it's local, after all. (This is in tree-emutls.c at lines 238 to 247 in both 4.6.1 and SVN revision 180430.) But the assertion in ipa.c "knows" anything weak must be either public or extern--that's the error in the ICE message. I don't know if the error is in clearing the 'public' flag, or in assuming everything weak is public or extern. Note I haven't yet gotten the trunk code to build; we've got a bit of a shortage of AIX horsepower. As there are trunk changes in both ipa.c and tree-emutls.c, it is possible AIX is fine with trunk but Tru64 still has issues.