http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50983
Bug #: 50983 Summary: [4.7 Regression] incorrect DW_LNS_negate_stmt Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: raviti...@lbl.gov CC: ja...@redhat.com An incorrect DW_LNS_negate_stmt doesn't allow to set breakpoints in some cases, e.g. given struct Base { Base(bool foo){ static bool bar; if (foo) bar = false; else bar = true;} }; void fun() { return; } int main(int argc, char *argv[]) { Base *b = new Base(true); fun(); return 0; } and compiling with -g, is_stmt is set to 0 after the end of the first sequence: readelf --debug-dump=rawline ./a.out ... Special opcode 103: advance Address by 7 to 0x40058d and Line by 0 to 4 Advance PC by 2 to 0x40058f Extended opcode 1: End of Sequence Set is_stmt to 0 Extended opcode 2: set Address to 0x400524 Special opcode 12: advance Address by 0 to 0x400524 and Line by 7 to 8 ... making it impossible to set a breakpoint on line 9 for instance. The proposed fix: gcc/Changelog: 2011-11-03 Roberto Agostino Vitillo <raviti...@lbl.gov> * dwarf2out.c (set_cur_line_info_table): Restore the last is_stmt value in the current line table. Index: gcc/gcc/dwarf2out.c =================================================================== --- gcc/gcc/dwarf2out.c (revision 180817) +++ gcc/gcc/dwarf2out.c (working copy) @@ -20363,6 +20363,9 @@ 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; } Tested on x86_64-linux. r