Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: emitted DWARF location for complex128 param is incorrect #45281

thanm opened this issue Mar 29, 2021 · 0 comments

cmd/compile: emitted DWARF location for complex128 param is incorrect #45281

thanm opened this issue Mar 29, 2021 · 0 comments


Copy link

@thanm thanm commented Mar 29, 2021

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

Using tip (linux.amd64)

$ go version
go version devel +565e70fcef Mon Mar 29 08:11:13 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?


What operating system and processor architecture are you using (go env)?


What did you do?

Compile this program:

and look at the DWARF generated for the function main.tryme

What did you expect to see?

Correct location expressions for all params

What did you see instead?

For the parameter "z", here is the parameter DIE:

 <2><3c428>: Abbrev Number: 16 (DW_TAG_formal_parameter)
    <3c429>   DW_AT_name        : z
    <3c42b>   DW_AT_variable_parameter: 0
    <3c42c>   DW_AT_decl_line   : 7
    <3c42d>   DW_AT_type        : <0x3e46a>
    <3c431>   DW_AT_location    : 0x5a5a3 (location list)

and here is the relevent .debug_loc section:

    0005a5a3 ffffffffffffffff 000000000045f340 (base address)
    0005a5b3 000000000045f340 000000000045f399 (DW_OP_fbreg: 24; DW_OP_piece: 8; DW_OP_fbreg: 24; DW_OP_piece: 8)
    0005a5cd <End of list>

Note the two pieces are the same (for real and imaginary). If I stop in a debugger and print the value of the param, I get:

(gdb) p z
$1 = 2 + 2i

which is obviously wrong (should be 1 + 2i).

I looked at older versions of Go (1.15, 1.14, and it appears that they get this wrong as well, although in slightly different ways).

@thanm thanm added this to the Go1.17 milestone Mar 29, 2021
@dr2chase dr2chase self-assigned this Mar 29, 2021
@ianlancetaylor ianlancetaylor added the NeedsInvestigation label Apr 19, 2021
@ianlancetaylor ianlancetaylor removed this from the Go1.17 milestone Apr 19, 2021
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants