You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug does not appear (at least with the same test code) on the development version
(go version devel +93ad232384f8 Fri Apr 11 10:11:21 2014 -0700 linux/amd64) and may
therefore be already fixed.
The combination of go 1.2, the race detector, a map of pointers and a function returning
two values somehow results in a nil dereference on linux/x86_64.
What does 'go version' print?
go version go1.2.1 linux/amd64
What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Compile http://play.golang.org/p/0fIDCUE2m2c with "-race"
2. Run it
What happened?
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x400c52]
goroutine 1 [running]:
runtime.panic(0x438400, 0x4aea68)
/build/go/src/go-1.2.1/src/pkg/runtime/panic.c:266 +0xb6
main.main()
main.go:10 +0x52
What should have happened instead?
no output
Either uncommenting the seemingly nop read from the map or compiling without
"-race" makes the segfault not happen.
The text was updated successfully, but these errors were encountered:
The playground link seems to be dead:
package main
var f = func() (int, int) {
return 0, 0
}
var m = map[int]*int{1: new(int)}
func main() {
// _ = m[1]
_, *m[1] = f()
}
Hello,
This appears to be fixed at tip.
odessa(~/src) % go run -race rr.go
odessa(~/src) % go version
go version devel +8e553855d1a3 Thu Apr 10 21:46:00 2014 -0700 + darwin/amd64
As it is very unlikely that there will be a 1.2.2 release, I'm making this issue fixed
for Go 1.3
Cheers
Dave
by andres.erbsen:
The text was updated successfully, but these errors were encountered: