From 603f595942ab9c42d6576039033c507191f00610 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Mon, 23 Mar 2009 23:21:38 +0000 Subject: re PR debug/39524 (Duplicate C++ DW_TAG_variable breaking its DW_AT_location resolution) PR debug/39524 * dwarf2out.c (gen_variable_die): Avoid adding duplicate declaration nodes. * g++.dg/debug/dwarf2/imported-decl-1.C: New test. Co-Authored-By: Jakub Jelinek From-SVN: r145018 --- gcc/dwarf2out.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/dwarf2out.c') diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index af5c994..9bf0803c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -13978,6 +13978,14 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) return; } + /* If the compiler emitted a definition for the DECL declaration + and if we already emitted a DIE for it, don't emit a second + DIE for it again. */ + if (old_die + && declaration + && old_die->die_parent == context_die) + return; + var_die = new_die (DW_TAG_variable, context_die, decl); origin_die = NULL; -- cgit v1.1