re PR debug/43325 (C++ external inner reference does not override outer scope)

Fix for PR debug/43325

gcc/ChangeLog:
	PR debug/43325
	* dwarf2out.c (gen_variable_die): Allow debug info for variable
	re-declaration when it happens in a function.

gcc/testsuite/ChangeLog:
	PR debug/43325
	* c-c++-common/dwarf2/redeclaration-1.C: New test.

From-SVN: r157928
This commit is contained in:
Dodji Seketeli 2010-04-01 18:54:30 +00:00 committed by Dodji Seketeli
parent d4b5fb2238
commit 777351a5fd
4 changed files with 32 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2010-04-01 Dodji Seketeli <dodji@redhat.com>
PR debug/43325
* dwarf2out.c (gen_variable_die): Allow debug info for variable
re-declaration when it happens in a function.
2010-04-01 Aldy Hernandez <aldyh@redhat.com>
* cgraph.c (cgraph_add_function_insertion_hook): Update comment.

View file

@ -18283,9 +18283,9 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
/* 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)
DIE for it again. Allow re-declarations of DECLs that are
inside functions, though. */
if (old_die && declaration && !local_scope_p (context_die))
return;
/* For static data members, the declaration in the class is supposed

View file

@ -1,3 +1,8 @@
2010-04-01 Dodji Seketeli <dodji@redhat.com>
PR debug/43325
* c-c++-common/dwarf2/redeclaration-1.C: New test.
2010-04-01 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/initlist12.C: Adjust expected errors.

View file

@ -0,0 +1,18 @@
// Origin: PR debug/43325
// { dg-options "-g -dA" }
// { dg-do compile }
// { dg-final { scan-assembler-times "\[^\n\r\]*\\(DIE \[^\n\r\]*DW_TAG_lexical_block\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_low_pc\[\n\r\]{1,2}\[^\n\r\]*DW_AT_high_pc\[\n\r\]{1,2}\[^\n\r\]*\\(DIE \[^\n\r\]*DW_TAG_variable\\)\[\n\r\]{1,2}\[^\n\r\]*DW_AT_name" 2 } }
namespace S
{
int
f()
{
int i = 42;
{
extern int i;
return i;
}
}
}