Thanks. I reformatted the patch a bit and added a testcase; here's what
I'm checking in.
commit 91eed4ebec24bbb2993c1ca8a5407f4fdeff48ec
Author: Jason Merrill <ja...@redhat.com>
Date: Thu Nov 10 00:11:13 2011 -0500
PR debug/50983
* dwarf2out.c (set_cur_line_info_table): Restore the last is_stmt
value in the current line table.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 39be9a1..7b5930e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -20371,6 +20371,10 @@ set_cur_line_info_table (section *sec)
VEC_safe_push (dw_line_info_table_p, gc, separate_line_info, table);
}
+ if (DWARF2_ASM_LINE_DEBUG_INFO)
+ table->is_stmt = (cur_line_info_table
+ ? cur_line_info_table->is_stmt
+ : DWARF_LINE_DEFAULT_IS_STMT_START);
cur_line_info_table = table;
}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/asm-line1.c b/gcc/testsuite/gcc.dg/debug/dwarf2/asm-line1.c
new file mode 100644
index 0000000..1d2e148
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/asm-line1.c
@@ -0,0 +1,20 @@
+/* PR debug/50983 */
+/* { dg-do compile { target *-*-linux-gnu } } */
+/* { dg-options "-O0 -gdwarf-2" } */
+/* { dg-final { scan-assembler "is_stmt 1" } } */
+
+int i;
+void f() __attribute ((section ("foo")));
+void f() { if (i) ++i; else --i; }
+
+void fun()
+{
+ return;
+}
+
+int main()
+{
+ f();
+ fun();
+ return 0;
+}