Backport from mainline
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.
* gcc.dg/debug/dwarf2/pr51410.c: New test.
From-SVN: r182114
Backport from mainline
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.
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. */
Backport from mainline
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.
--- /dev/null
+/* 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 } } */