On Fri, Mar 24, 2017 at 09:07:54AM -0400, Jason Merrill wrote: > >> And when it's cloned. > >> > >> But does it make sense for gen_decl_die to call > >> dwarf2out_abstract_function when decl is null? That seems wrong. > > > > Before r144529 we had just: > > if (DECL_ORIGIN (decl) != decl) > > dwarf2out_abstract_function (DECL_ABSTRACT_ORIGIN (decl)); > > and that is indeed to handle clones etc. > > > > r144529 changed that to: > > if (origin || DECL_ORIGIN (decl) != decl) > > dwarf2out_abstract_function (DECL_ABSTRACT_ORIGIN (decl)); > > All of the decl is NULL introduced in r144529 implies decl_or_origin > > is abstract. > > > > Removing that origin || wouldn't really work, we'd have to rewrite most of > > gen_decl_die FUNCTION_DECL handling to use decl_or_origin instead of > > decl etc. > > I was thinking to change it to > > if (decl && (origin || DECL_ORIGIN (decl) != decl))
But then you segfault immediately on the next: else if (cgraph_function_possibly_inlined_p (decl) && ! DECL_ABSTRACT_P (decl) because decl is NULL. So, it would be far easier to do: if (decl == NULL_TREE) { decl = origin; origin = NULL_TREE; } before the if (origin || DECL_ORIGIN (decl) != decl) with a comment, rather than to rewrite a couple of dozen decl_or_origin, and change assumptions that non-NULL origin actually means anything for FUNCTION_DECL. That is IMO still uglier than the decls_for_scope change though, but if you prefer that, I can test that. Jakub