-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
parent: 14564:3350c94fe6b7 tip
test$ go run -race run.go
WARNING: DATA RACE
Read by goroutine 4:
io/ioutil.nextSuffix()
/usr/local/google/home/dvyukov/go_prefetch/src/pkg/io/ioutil/tempfile.go:25 +0x2d
io/ioutil.TempDir()
/usr/local/google/home/dvyukov/go_prefetch/src/pkg/io/ioutil/tempfile.go:77 +0xad
main.(*test).makeTempDir()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:496 +0x41
main.(*test).run()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:323 +0x74a
main.func·001()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:233 +0x3a
Previous write by goroutine 3:
io/ioutil.nextSuffix()
/usr/local/google/home/dvyukov/go_prefetch/src/pkg/io/ioutil/tempfile.go:30 +0x64
io/ioutil.TempDir()
/usr/local/google/home/dvyukov/go_prefetch/src/pkg/io/ioutil/tempfile.go:77 +0xad
main.(*test).makeTempDir()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:496 +0x41
main.(*test).run()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:323 +0x74a
main.func·001()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:233 +0x3a
Goroutine 4 (running) created at:
main.runTests()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:235 +0xc6
Goroutine 3 (running) created at:
main.runTests()
/usr/local/google/home/dvyukov/go_prefetch/test/run.go:235 +0xc6
This can break badly under gccgo:
var rand uint32
func nextSuffix() string {
r := rand
if r == 0 {
r = reseed()
}
r = r*1664525 + 1013904223 // constants from Numerical Recipes
rand = r
return strconv.Itoa(int(1e9 + r%1e9))[1:]
}