https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94005
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-03-03 CC| |aoliva at gcc dot gnu.org Version|unknown |10.0 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- I think this is again the question of whether breaking at 11 is supposed to be before or after the stmt is executed. Clearly 'e' is zero and we have before optimization starts [x.c:11:3] # DEBUG BEGIN_STMT [x.c:11:5] l_21 = e; [x.c:11:5] # DEBUG l => l_21 [x.c:12:1] return; and then it unfolds as [x.c:11:3] # DEBUG BEGIN_STMT [x.c:11:5] # DEBUG l => 0 [x.c:12:1] return; which is to be expected. Now, breaking at line 11 ends up at Dump of assembler code for function i: 0x0000000000400474 <+0>: mov 0x200bae(%rip),%eax # 0x601028 <b> 0x000000000040047a <+6>: and $0x9f,%eax 0x000000000040047f <+11>: mov %al,0x200bab(%rip) # 0x601030 <f> => 0x0000000000400485 <+17>: retq but then we have 00000000 v000000000000000 v000000000000001 location view pair 00000002 v000000000000001 v000000000000000 location view pair 00000004 v000000000000000 v000000000000001 views at 00000000 for: 000000000040047f 0000000000400485 (DW_OP_reg0 (rax)) 00000017 v000000000000001 v000000000000000 views at 00000002 for: 0000000000400485 0000000000400486 (DW_OP_lit0; DW_OP_stack_value) 0000002b <End of list> for <2><1af>: Abbrev Number: 9 (DW_TAG_variable) <1b0> DW_AT_name : l <1b2> DW_AT_decl_file : 1 <1b3> DW_AT_decl_line : 8 <1b4> DW_AT_decl_column : 7 <1b5> DW_AT_type : <0x108> <1b9> DW_AT_location : 0x4 (location list) <1bd> DW_AT_GNU_locviews: 0x0 So - this looks like a debug consumer issue to me. Note with -gstrict-dwarf we end up with (also expected from my POV): <2><19d>: Abbrev Number: 8 (DW_TAG_variable) <19e> DW_AT_name : l <1a0> DW_AT_decl_file : 1 <1a1> DW_AT_decl_line : 8 <1a2> DW_AT_decl_column : 7 <1a3> DW_AT_type : <0x108> <1a7> DW_AT_location : 0x0 (location list) 00000000 000000000040047f 0000000000400485 (DW_OP_reg0 (rax)) 00000013 0000000000400485 0000000000400486 (DW_OP_lit0; DW_OP_stack_value) 00000027 <End of list> but line 11 is again at 0x0000000000400485 ... So the issue would be that the line number program is suboptimal? Esp. the is_stmt 0 at 0x00000143? [0x0000013c] Special opcode 159: advance Address by 11 to 0x40047f and Line by 0 to 10 [0x0000013d] Set column to 3 [0x0000013f] Set is_stmt to 1 [0x00000140] Special opcode 90: advance Address by 6 to 0x400485 and Line by 1 to 11 [0x00000141] Set column to 1 [0x00000143] Set is_stmt to 0 [0x00000144] Special opcode 6: advance Address by 0 to 0x400485 and Line by 1 to 12 (view 1) [0x00000145] Set column to 12 [0x00000147] Set is_stmt to 1 [0x00000148] Special opcode 20: advance Address by 1 to 0x400486 and Line by 1 to 13 [0x00000149] Set column to 14 [0x0000014b] Copy (view 1) [0x0000014c] Set column to 1 [0x0000014e] Set is_stmt to 0