https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78112
--- Comment #11 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #9 from Pierre-Marie de Rodat <derodat at adacore dot com> --- [...] > My analysis so far is that gen_subprogram_die is supposed to be called a very > specific number of times for each function and my change from 2016-10-12 made > it run more times, so it unintentionally added some attributes more than just > once. The following patch seems to restore call count to what we had > previously: > > diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c > index 78a2979..a85ab3b 100644 > --- a/gcc/dwarf2out.c > +++ b/gcc/dwarf2out.c > @@ -23909,11 +23909,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); > > I’m currently bootstrapping+regtesting it on x86_64-linux. I tried to come up > with a regression testcase for it, but I can’t find a human-friendly regexp > for > scan-assembler-times to check that we don’t have multiple attributes per tag. > So for local testing, I wrote a Python3 script to use the pyelftools library. > I’ll file it right after sending this message if others need to use it. I've just completed a x86_64-apple-darwin16.3.0 bootstrap with your patch included and all the libstdc++ failues are gone indeed. Thanks. Rainer