diff options
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-decl.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c | 13 |
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9767de4..52c1de5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 4338fdf..1cdbf2f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 73cef0b..654a56e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c new file mode 100644 index 0000000..957c152 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr51410.c @@ -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 } } */ |