summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-22 16:25:17 +0000
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-22 16:25:17 +0000
commit60bf07c739ff2b330975a110c607b80feaa7d1d9 (patch)
tree4aceab85a0b196e0ed32687ec59376296d1556a1 /gcc/dwarf2out.c
parentbe18556fae23e5b53c6219b22f23aeba6ccc2b32 (diff)
downloadgcc-60bf07c739ff2b330975a110c607b80feaa7d1d9.tar.gz
Fix PR debug/45024
gcc/ChangeLog: PR debug/45024 * dwarf2out.c (scope_die_for): Don't fall back to the compilation unit DIE if we can find the scope DIE. gcc/testsuite/ChangeLog: PR debug/45024 * g++.dg/debug/dwarf2/nested-2.C: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162420 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ce35c9182e1..183bbd38a2b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -17585,9 +17585,13 @@ scope_die_for (tree t, dw_die_ref context_die)
{
gcc_assert (debug_info_level <= DINFO_LEVEL_TERSE
|| TREE_ASM_WRITTEN (containing_scope));
+ /*We are not in the middle of emitting the type
+ CONTAINING_SCOPE. Let's see if it's emitted already. */
+ scope_die = lookup_type_die (containing_scope);
/* If none of the current dies are suitable, we get file scope. */
- scope_die = comp_unit_die;
+ if (scope_die == NULL)
+ scope_die = comp_unit_die;
}
else
scope_die = lookup_type_die (containing_scope);