http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36352
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org, | |jakub at redhat dot com --- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-11-10 18:17:15 UTC --- We are not able to declare the var as readonly since we think that it might be accessed by other module. This is not true for local static of comdats as we know what that comdat does with the function, but it is bit difficult to take advantage of this because we see code after optimization and it is possible that we optimized away the access in this unit but not in other. Only way I see to handle this safely is to have ipa-reference done before early optimization. I tried that some time ago and I know it broke thread local storage because it does part of job at gimplification and part of job afterwards leading to confusion when var becomes read only (it stays accessed as thread local but it is not brought thread local by the later pass). This is lost optimization. Jakub, Richard, perhaps the rewrite made this possible? It would be nice cleanup.