https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29461

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
 <2><6c>: Abbrev Number: 8 (DW_TAG_formal_parameter)
    <6d>   DW_AT_name        : s_p
    <71>   DW_AT_decl_file   : 1
    <72>   DW_AT_decl_line   : 3
    <73>   DW_AT_decl_column : 19
    <74>   DW_AT_type        : <0x8a>
    <78>   DW_AT_location    : 2 byte block: 91 58      (DW_OP_fbreg: -40)
 <2><7b>: Abbrev Number: 9 (DW_TAG_variable)
    <7c>   DW_AT_name        : ss
    <7f>   DW_AT_decl_file   : 1
    <80>   DW_AT_decl_line   : 5
    <81>   DW_AT_decl_column : 20
    <82>   DW_AT_type        : <0x46>
    <86>   DW_AT_location    : 2 byte block: 91 68      (DW_OP_fbreg: -24)

so we can and do now make those equal.  With -O1 we have

 <2><6c>: Abbrev Number: 9 (DW_TAG_formal_parameter)
    <6d>   DW_AT_name        : s_p
    <71>   DW_AT_decl_file   : 1
    <72>   DW_AT_decl_line   : 3
    <73>   DW_AT_decl_column : 19
    <74>   DW_AT_type        : <0xc0>
    <78>   DW_AT_location    : 0x12 (location list)
    <7c>   DW_AT_GNU_locviews: 0xc
 <2><80>: Abbrev Number: 10 (DW_TAG_variable)
    <81>   DW_AT_name        : ss
    <84>   DW_AT_decl_file   : 1
    <85>   DW_AT_decl_line   : 5
    <86>   DW_AT_decl_column : 20
    <87>   DW_AT_type        : <0x46>
    <8b>   DW_AT_location    : 0x2b (location list)
    <8f>   DW_AT_GNU_locviews: 0x25

    00000012 v000000000000000 v000000000000000 views at 0000000c for:
             0000000000000000 0000000000000008 (DW_OP_reg5 (rdi))
    00000017 v000000000000000 v000000000000000 views at 0000000e for:
             0000000000000008 0000000000000012 (DW_OP_reg3 (rbx))
    0000001c v000000000000000 v000000000000000 views at 00000010 for:
             0000000000000012 0000000000000013 (DW_OP_entry_value: (DW_OP_reg5
(rdi)); DW_OP_stack_value)
    00000024 <End of list>

    0000002b v000000000000001 v000000000000000 views at 00000025 for:
             0000000000000004 0000000000000008 (DW_OP_reg5 (rdi))
    00000030 v000000000000000 v000000000000000 views at 00000027 for:
             0000000000000008 0000000000000012 (DW_OP_reg3 (rbx))
    00000035 v000000000000000 v000000000000000 views at 00000029 for:
             0000000000000012 0000000000000013 (DW_OP_entry_value: (DW_OP_reg5
(rdi)); DW_OP_stack_value)
    0000003d <End of list>

which is nearly equivalent and I suppose "correct" in that we're not
showing it live during the prologue before the declaration/assignment

func2:
.LVL0:
.LFB0:
        .file 1 "t.c"
        .loc 1 4 1 view -0
        .cfi_startproc
        .loc 1 4 1 is_stmt 0 view .LVU1
        pushq   %rbx
        .cfi_def_cfa_offset 16
        .cfi_offset 3, -16
        movq    %rdi, %rbx
        .loc 1 5 3 is_stmt 1 view .LVU2
.LVL1:
        .loc 1 6 3 view .LVU3
        call    func

-O0 vs -O is also -fno-var-tracking vs. -fvar-tracking of course.

Reply via email to