Hi! I think the main question is whether we should accept leaf attribute on weakrefs, despite them being marked as !TREE_PUBLIC.
I know we haven't allowed that until now, but weakrefs are weirdo things which have both static and external effects, static for that they are a local alias and external for being actually aliases to (usually) external functions. If we add a weakref for some function declared as leaf, it is unnecessarily pessimizing when we don't allow the leaf attribute on the weakref. Your patch looks reasonable to me to revert to previous state, but if we decide to change the above, it would need to change. On Thu, Dec 20, 2018 at 08:45:03PM -0700, Martin Sebor wrote: > --- gcc/c-family/c-attribs.c (revision 267282) > +++ gcc/c-family/c-attribs.c (working copy) > @@ -2455,6 +2455,12 @@ handle_copy_attribute (tree *node, tree name, tree > || is_attribute_p ("weakref", atname)) > continue; > > + /* Aattribute leaf only applies to extern functions. > + Avoid copying it to static ones. */ s/Aatribute/Attribute/ Jakub