http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53093
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> 2012-04-26 21:13:35 UTC --- Created attachment 27250 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27250 proposed fix. Thank you. I actually found why the numbers does not match. I was wrong with my previous analysis - the aliases are counted in first loop. The issue is that when handling aliases the code is creating new aliases as it walks the tree. It depends on luck whether the walk will pick the new alias or not. Can you, please try once again the attached patch? It should restore the original behavior. I am not sure that the code makes sense: I would expect TLS var of alias to be alias of the TLS var of the target. The code however creates alias of the target instead. I can't think of explanation how that would make sense. Does the aliases behave sanely with emutls? Honza