This program
1 package main
2
3 func main() {
4 var x int
5 ch := make(chan bool, 1)
6 ch <- true
7 <-ch
8 go func() {
9 x = 1
10 ch <- true
11 }()
12 x = 2
13 <-ch
14 }
produces this report:
INFO: T0 is program's main thread
INFO: T1 has been created by T0 at this point: {{{
#0 main.main ~/go/misc/racecheck/gotsan/race.go:8
#1 runtime.main ~/go/src/pkg/runtime/proc.c:238
}}}
WARNING: Possible data race during write of size 1 at 0xf840000000: {{{
T1 (L{}):
#0 main._func_001 ~/go/misc/racecheck/gotsan/race.go:10
#1 runtime.goexit ~/go/src/pkg/runtime/proc.c:266
Concurrent write(s) happened at (OR AFTER) these points:
T0 (L{}):
#0 main.main ~/go/misc/racecheck/gotsan/race.go:13
#1 runtime.main ~/go/src/pkg/runtime/proc.c:238
Location 0xf840000000 is 0 bytes inside a block starting at 0xf840000000 of size 8 allocated by T0 from heap:
#0 main.main ~/go/misc/racecheck/gotsan/race.go:5
#1 runtime.main ~/go/src/pkg/runtime/proc.c:238
}}}
and an even less readable report when lines 6 and 7 commented out
Original issue reported on code.google.com by mpime...@google.com on 16 Jan 2012 at 2:58
Original issue reported on code.google.com by
mpime...@google.com
on 16 Jan 2012 at 2:58