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

Comments

Projects
None yet
3 participants
@davidlazar
Copy link
Member

commented Mar 9, 2017

$ 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

This comment has been minimized.

Copy link

commented Mar 9, 2017

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 label Mar 21, 2017

@gopherbot gopherbot closed this in 83843b1 Mar 29, 2017

lparth added a commit to lparth/go that referenced this issue Apr 13, 2017

cmd/compile: fix names of inlined methods from other packages
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.
You can’t perform that action at this time.