https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63572
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Better testcase, where ICF actually happens. struct S { int a; int b; int c; }; __attribute__((noinline)) static int f1 (struct S *x) { static int u = 1; int g = x->a * 7; { static int v = 2; int h = x->b * 11; int i = x->c; return g + h + i; } } __attribute__((noinline)) static int f2 (struct S *x) { static int w = 3; int j = x->a * 7; int k = x->b * 11; { static int y = 4; int l = x->c; return j + k + l; } } __attribute__((noinline)) int f3 (struct S *x) { return f1 (x); } __attribute__((noinline)) int f4 (struct S *x) { return f2 (x) + 1; } __attribute__((noinline)) int f5 (struct S *x) { return f1 (x) + 2; } __attribute__((noinline)) int f6 (struct S *x) { return f2 (x) + 3; } int main () { struct S s = { 1, 2, 3 }; asm volatile ("" : : "r" (&s) : "memory"); int a[4]; a[0] = f3 (&s); a[1] = f4 (&s); a[2] = f5 (&s); a[3] = f6 (&s); asm volatile ("" : : "r" (a) : "memory"); return 0; } As for .debug_line, the only solution which doesn't require any extensions would be IMHO to put the icf_merged clone's DW_TAG_subprogram into its own DW_TAG_partial_unit, import it into the DW_TAG_compile_unit where it is needed, and use a different DW_AT_stmt_list offset in there, and emit part of .debug_line (the one for the icf_merged aliases) manually into .debug_line by the compiler and see whether the assembler will deal with it properly. Anyway, the ideal user debugging experience IMHO with the above testcase is: b f1 - debugger finds out that f1 and f2 subprograms have overlapping ranges, puts a breakpoint into f1==f2 prologue, and when the breakpoint is hit, unwinds, checks if from the backtrace it is possible using DW_TAG_GNU_call_site figure out which of the functions has been called; if it is, depending on if it is f1 or f2 either honors or ignores the breakpoint; if it isn't possible to uniquely identify what the caller meant to call, honor the breakpoint. To map instructions back to line info, blocks etc., again, check unwind info/backtrace which function it is, if it is known which one it is, go into .debug_line table corresponding to the CU/PU of the subprogram, otherwise pick one. Ditto for the DW_TAG_subprogram/DW_TAG_lexical_block/DW_TAG_inlined_subroutine trees. Does that sound like a plan?