re PR debug/51410 (duplicate variable DIE)

PR debug/51410
	* c-decl.c (pop_scope): Don't add DECL_EXTERNAL decls
	for debug info if scope is file_scope.

	* gcc.dg/debug/dwarf2/pr51410.c: New test.

From-SVN: r182027
This commit is contained in:
Jakub Jelinek 2011-12-05 21:51:07 +01:00 committed by Jakub Jelinek
parent 156030d35f
commit 17fe0fdbad
4 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2011-12-05 Jakub Jelinek <jakub@redhat.com>
PR debug/51410
* c-decl.c (pop_scope): Don't add DECL_EXTERNAL decls
for debug info if scope is file_scope.
PR c/51339
* c-decl.c (c_finish_incomplete_decl, finish_decl): Call
relayout_decl instead of layout_decl.

View File

@ -1196,7 +1196,7 @@ pop_scope (void)
DECL_CHAIN (p) = BLOCK_VARS (block);
BLOCK_VARS (block) = p;
}
else if (VAR_OR_FUNCTION_DECL_P (p))
else if (VAR_OR_FUNCTION_DECL_P (p) && scope != file_scope)
{
/* For block local externs add a special
DECL_EXTERNAL decl for debug info generation. */

View File

@ -1,5 +1,8 @@
2011-12-05 Jakub Jelinek <jakub@redhat.com>
PR debug/51410
* gcc.dg/debug/dwarf2/pr51410.c: New test.
PR c/51339
* gcc.dg/gomp/pr51339.c: New test.

View File

@ -0,0 +1,13 @@
/* PR debug/51410 */
/* { dg-do compile } */
/* { dg-options "-O0 -gdwarf-2 -dA -fno-merge-debug-strings" } */
int x;
int
foo (void)
{
return x;
}
/* { dg-final { scan-assembler-times "\\(DIE\[^\\r\\n\]*DW_TAG_variable\\)" 1 } } */