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: wrong declaration line in debug_info for variables captured in a closure #36542

Open
aarzilli opened this issue Jan 14, 2020 · 2 comments
Milestone

Comments

@aarzilli
Copy link
Contributor

@aarzilli aarzilli commented Jan 14, 2020

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).

@aarzilli

This comment has been minimized.

Copy link
Contributor Author

@aarzilli aarzilli commented Jan 14, 2020

Note: this is not a regression.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 14, 2020

Change https://golang.org/cl/214637 mentions this issue: cmd/compile: assign correct declaration line to DIE of captured vars

@ALTree ALTree added this to the Backlog milestone Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.