On Tue, Jun 11, 2013 at 08:39:07PM +0200, Jan Hubicka wrote: > > @@ -6802,10 +6802,20 @@ decl_binds_to_current_def_p (tree decl) > > return resolution_to_local_definition_p (node->symbol.resolution); > > } > > /* Otherwise we have to assume the worst for DECL_WEAK (hidden weaks > > - binds locally but still can be overwritten). > > + binds locally but still can be overwritten), DECL_COMMON (can be > > merged > > + with a non-common definition somewhere in the same module) or > > + DECL_EXTERNAL. > > This rely on fact that binds_local_p behave as decl_replaceable_p > > for all other declaration types. */ > > - return !DECL_WEAK (decl); > > + if (DECL_WEAK (decl)) > > + return false; > > + if (DECL_COMMON (decl) > > + && (DECL_INITIAL (decl) == NULL > > + || DECL_INITIAL (decl) == error_mark_node)) > > + return false; > > As discussed on IRC, this will return unnecesarily conservative answer for > HIDDEN visibility and (resolution == LDPR_PREVAILING_DEF_IRONLY or resolution > == LDPR_PREVAILING_DEF) symbols.
If resolution is not LDPR_UNKNOWN, then we don't enter this code at all. In that case we simply check binds_local_p (it returns true for those), !TREE_PUBLIC (false), and then just look at at the resolution (so preexisting code). Jakub