Skip to content

cmd/compile: wrong declaration line in debug_info for variables captured in a closure #36542

Closed
@aarzilli

Description

@aarzilli

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

$ go version
go version devel +f376b8510e Fri Jan 3 01:36:26 2020 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

Compile:

package main

import (
	"fmt"
)

func f1(a int) {
	fmt.Printf("a: %d\n", a)
}

func main() {
	a := 1
	f := func() {
		f1(a)
	}
	f()
}

check the DW_AT_decl_line attribute of the variable a in main.main.func1

What did you expect to see?

line 12

What did you see instead?

line 14 (the first use of a inside the closure).

Metadata

Metadata

Assignees

No one assigned

    Labels

    DebuggingFrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions