https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87440
Bernd Edlinger <bernd.edlinger at hotmail dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernd.edlinger at hotmail dot de --- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- This is only fixed for inlined subroutines with just one subrange, but not for the case when a subroutine has multiple subranges, as in this example: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/testsuite/gdb.cp/step-and-next-inline.cc;h=ac92206fd7f9036b909968b46355bdb8c6861ec3;hb=HEAD $ gcc -g -O2 step-and-next-inline.cc here the first invocation of "tree_check" has multiple subranges, and a redundant lexical block: <2><865>: Abbrev Number: 41 (DW_TAG_inlined_subroutine) <866> DW_AT_abstract_origin: <0x955> <86a> DW_AT_entry_pc : 0x401165 <872> DW_AT_GNU_entry_view: 0 <873> DW_AT_ranges : 0x21 <877> DW_AT_call_file : 1 <878> DW_AT_call_line : 52 <879> DW_AT_call_column : 10 <87a> DW_AT_sibling : <0x8b9> <3><87e>: Abbrev Number: 8 (DW_TAG_formal_parameter) <87f> DW_AT_abstract_origin: <0x966> <883> DW_AT_location : 0x37 (location list) <887> DW_AT_GNU_locviews: 0x35 <3><88b>: Abbrev Number: 8 (DW_TAG_formal_parameter) <88c> DW_AT_abstract_origin: <0x96e> <890> DW_AT_location : 0x46 (location list) <894> DW_AT_GNU_locviews: 0x44 <3><898>: Abbrev Number: 42 (DW_TAG_lexical_block) <899> DW_AT_ranges : 0x21 while the other invocations look like: <2><8b9>: Abbrev Number: 44 (DW_TAG_inlined_subroutine) <8ba> DW_AT_abstract_origin: <0x955> <8be> DW_AT_entry_pc : 0x401177 <8c6> DW_AT_GNU_entry_view: 0 <8c7> DW_AT_low_pc : 0x401177 <8cf> DW_AT_high_pc : 0xa <8d7> DW_AT_call_file : 1 <8d8> DW_AT_call_line : 53 <8d9> DW_AT_call_column : 10 <8da> DW_AT_sibling : <0x906> ... and happen to be fixed by : https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ac02e5b75451cc3c6ae9028338183bcdcb056ea2 This is not a big issue, but the duplicated variables show up only while stepping thru the first invocation: $ gdb a.out [...] Breakpoint 1, main () at step-and-next-inline.cc:64 64 get_alias_set (&xx); /* Beginning of main */ (gdb) s get_alias_set (t=t@entry=0x404020 <xx>) at step-and-next-inline.cc:51 51 if (t != NULL (gdb) s 52 && TREE_TYPE (t).z != 1 (gdb) s tree_check (t=0x404020 <xx>, i=0) at step-and-next-inline.cc:40 40 if (t->x != i) (gdb) info locals x = <optimized out> x = <optimized out> (gdb) I have a patch...