On 11/13/20 10:54 AM, Jakub Jelinek via Gcc-patches wrote: > Hi! > > Aldy's PR71855 fix avoided emitting multiple redundant > DW_TAG_unspecified_parameters sub-DIEs of a single DIE by restricting > it to early dwarf only. That unfortunately means if we need to emit > another DIE for the function (whether it is for LTO, or e.g. because of > IPA cloning), we don't emit DW_TAG_unspecified_parameters, it remains > solely in the DW_AT_abstract_origin's referenced DIE. > But DWARF consumers don't really use DW_TAG_unspecified_parameters > from there, like we duplicate DW_TAG_formal_parameter sub-DIEs even in the > clones because either they have some more specific location, or e.g. > a function clone could have fewer or different argument types etc., > they need to assume that originally stdarg function isn't later stdarg etc. > Unfortunately, while for DW_TAG_formal_parameter sub-DIEs, we can use the > hash tabs to look the PARM_DECLs if we already have the DIEs, for > DW_TAG_unspecified_parameters we don't have an easy way to look it up. > > The following patch handles it by trying to figure out if we are creating a > fresh new DIE (in that case we add DW_TAG_unspecified_parameters if it is > stdarg), or if gen_subprogram_die is called again on an pre-existing DIE > to fill in some further details (then it will not touch it). > > Except for lto, subr_die != old_die would be good enough, but unfortunately > for LTO the new DIE that will refer to early dwarf created DIE is created > on the fly during lookup_decl_die. So the patch tracks if the DIE has > no children before any children are added to it. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2020-11-13 Jakub Jelinek <ja...@redhat.com> > > PR debug/97599 > * dwarf2out.c (gen_subprogram_die): Call > gen_unspecified_parameters_die even if not early dwarf, but only > if subr_die is a newly created DIE.
OK jeff