What steps will reproduce the problem?
1. go run -race this:
package main
import "runtime"
func F(j *int) {
for i := 0; i < 10; i++ {
*j = *j + 1
}
}
func main() {
var j int
go func() { F(&j) }()
go func() { F(&j) }()
runtime.Goexit()
}
What is the expected output? What do you see instead?
Expected:
WARNING: DATA RACE
Write by goroutine 3:
main.F()
/tmp/test.go:7 +0x41
main.func·002()
/tmp/test.go:15 +0x32
Previous write by goroutine 2:
main.F()
/tmp/test.go:7 +0x41
main.func·001()
/tmp/test.go:14 +0x32
Goroutine 3 (running) created at:
main.main()
/tmp/test.go:15 +0x71
runtime.main()
/opt/remy/go.clean/src/pkg/runtime/proc.c:255 +0x8e
Goroutine 2 (finished) created at:
main.main()
/tmp/test.go:14 +0x5a
runtime.main()
/opt/remy/go.clean/src/pkg/runtime/proc.c:255 +0x8e
Got:
WARNING: DATA RACE
Write by goroutine 4:
main.F()
/tmp/test.go:7 +0x41
??()
-:0 +0x231df
??()
-:0 +0x231df
Previous write by goroutine 3:
main.F()
/tmp/test.go:7 +0x41
??()
-:0 +0x231ef
??()
-:0 +0x231ef
Goroutine 4 (running) created at:
main.main()
/tmp/test.go:15 +0xef
??()
-:0 +0x20ce1ef7
Goroutine 3 (finished) created at:
main.main()
/tmp/test.go:14 +0x99
??()
-:0 +0x20ce1ef7
Please use labels and text to provide additional information.
The text was updated successfully, but these errors were encountered:
gc's assumes -8(FP) is the return address, maybe this got wrong in some way?
The code in runtime/race.c can also be simplified to remove comparisons of PC with arena
start/end since it is no longer relevant.
The text was updated successfully, but these errors were encountered: