------- Comment #12 from aldot at gcc dot gnu dot org 2006-08-20 12:53 ------- (In reply to comment #11) > Subject: Re: externally_visible attribute not effective with prior > declaration > of symbol. > > > Is there any reason why process_function_and_variable_attributes is called > > at the end of each TU rather than when all TUs were already parsed? > > The reason is that we do unreachable function removal after each unit > (to conserve memory) and for that we do need to process USED attributes > (not really the externally_visible as those are used only in > cgraph_optimize). Keeping handling of USED attributes at TU basis, > while moving externally_visible to global basis would not completely > work, since USED attributes in whole program mode can be used for public > variables too, pretty much as externally_visible is used in the > testcase.
If this is really true, then there are several bugs (in the FEs?) because there are numerous occurances where referenced_vars_insert() is called with TREE_USED(to) == 0 Should there be an assertion that only TREE_USED() > 0 are valid targets for insertion in/after dfa? > > I guess only solution is to process all TU local objects at the end of > each TU and all global objects at the cgraph_optimize stage. I will > post the patch for this. > > Thank you for looking into those dead ends! > Honza > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28744