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: inlined methods from other packages have the wrong name #19467

Closed
davidlazar opened this issue Mar 9, 2017 · 1 comment
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@davidlazar
Copy link
Member

$ cat x.go
package main

import (
	"sync"
)

func main() {
	var wg sync.WaitGroup
	wg.Done()
}

The wg.Done() method call is inlined with -l=4:

$ go run -a -gcflags '-l=4' x.go
panic: sync: negative WaitGroup counter

goroutine 1 [running]:
sync.(*WaitGroup).Add(0xc42000e110, 0xffffffffffffffff)
	/home/david/go/src/sync/waitgroup.go:75 +0x13b
main.(*sync.WaitGroup).Done(...)
	/home/david/go/src/sync/waitgroup.go:100
main.main()
	/home/david/go/test/x.go:9 +0x44
exit status 2

I expect to see sync.(*WaitGroup).Done(...), not main.(*sync.WaitGroup).Done(...).

cc @mdempsky

@gopherbot
Copy link

CL https://golang.org/cl/37866 mentions this issue.

@bradfitz bradfitz added this to the Go1.9 milestone Mar 21, 2017
@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 21, 2017
lparth pushed a commit to lparth/go that referenced this issue Apr 13, 2017
Previously, an inlined call to wg.Done() in package main would have the
following incorrect symbol name:

    main.(*sync.WaitGroup).Done

This change modifies methodname to return the correct symbol name:

    sync.(*WaitGroup).Done

This fix was suggested by @mdempsky.

Fixes golang#19467.

Change-Id: I0117838679ac5353789299c618ff8c326712d94d
Reviewed-on: https://go-review.googlesource.com/37866
Reviewed-by: Austin Clements <austin@google.com>
@golang golang locked and limited conversation to collaborators Mar 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants