Skip to content

cmd/compile: escaped local variables aren't assigned to the correct lexical block in debug_info #20959

Closed
@aarzilli

Description

@aarzilli

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.9 beta 2

What did you do?

Compiled this program with -gcflags '-N -l', ran objdump --dwarf

Result:

 <1><26358>: Abbrev Number: 2 (DW_TAG_subprogram)
    <26359>   DW_AT_name        : main.main
    <26363>   DW_AT_low_pc      : 0x487a50
    <2636b>   DW_AT_high_pc     : 0x487ce7
    <26373>   DW_AT_frame_base  : 1 byte block: 9c      (DW_OP_call_frame_cfa)
    <26375>   DW_AT_external    : 1
 <2><26376>: Abbrev Number: 4 (DW_TAG_variable)
    <26377>   DW_AT_name        : &a
    <2637a>   DW_AT_location    : 5 byte block: 9c 11 e8 7e 22  (DW_OP_call_frame_cfa; DW_OP_consts: -152; DW_OP_plus)
    <26380>   DW_AT_type        : <0x32175>
 <2><26384>: Abbrev Number: 6 (DW_TAG_lexical_block)
    <26385>   DW_AT_ranges      : 0x0
 <3><26389>: Abbrev Number: 4 (DW_TAG_variable)
    <2638a>   DW_AT_name        : a
    <2638c>   DW_AT_location    : 5 byte block: 9c 11 b0 7e 22  (DW_OP_call_frame_cfa; DW_OP_consts: -208; DW_OP_plus)
    <26392>   DW_AT_type        : <0x27f27>
 <3><26396>: Abbrev Number: 6 (DW_TAG_lexical_block)
    <26397>   DW_AT_ranges      : 0x40
 <4><2639b>: Abbrev Number: 4 (DW_TAG_variable)
    <2639c>   DW_AT_name        : p
    <2639e>   DW_AT_location    : 5 byte block: 9c 11 c8 7e 22  (DW_OP_call_frame_cfa; DW_OP_consts: -184; DW_OP_plus)
    <263a4>   DW_AT_type        : <0x32175>
 <4><263a8>: Abbrev Number: 0
 <3><263a9>: Abbrev Number: 0
 <2><263aa>: Abbrev Number: 0

The &a variable should have been inside the second lexical block, together with p.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions