On Tue, Nov 8, 2016 at 3:24 PM, Pierre-Marie de Rodat <dero...@adacore.com> wrote: > Hello, > > This patch comes from the discussion for PR debug/78112 > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78112). It seems to fix > the regression Rainer detected on x86_64-apple-darwin, although I still > wonder why remaining duplicate attributes (which were already present > before my original patch) are not a problem on this platform. > > Anyway, bootstrapped and regtested on x86_64-linux. As I said on the > PR, I managed to check with a Python script that there were no > duplicates anymore but I don't know how to turn this into a DejaGNU > testcase.
Using scan-assembler-times on the dwarf? > Ok to commit? Ok. Richard. > gcc/ > > PR debug/78112 > * dwarf2out.c (dwarf2out_early_global_decl): Call dwarf2out_decl > on the context only when it has no DIE yet. > --- > gcc/dwarf2out.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c > index 1dfff38..f9ec090 100644 > --- a/gcc/dwarf2out.c > +++ b/gcc/dwarf2out.c > @@ -25256,11 +25256,11 @@ dwarf2out_early_global_decl (tree decl) > if (!DECL_STRUCT_FUNCTION (decl)) > goto early_decl_exit; > > - /* For nested functions, emit DIEs for the parents first so that all > - nested DIEs are generated at the proper scope in the first > - shot. */ > + /* For nested functions, make sure we have DIEs for the parents > first > + so that all nested DIEs are generated at the proper scope in the > + first shot. */ > tree context = decl_function_context (decl); > - if (context != NULL) > + if (context != NULL && lookup_decl_die (context) == NULL) > { > current_function_decl = context; > dwarf2out_decl (context); > -- > 2.10.2 >