mirror of
https://github.com/golang/go
synced 2024-11-19 16:54:44 -07:00
cmd/gc: fix handling of for post-condition in -race mode
Fixes #8102. LGTM=bradfitz, dvyukov R=golang-codereviews, bradfitz, dvyukov CC=golang-codereviews https://golang.org/cl/100870046
This commit is contained in:
parent
19c8f67e25
commit
e56dc99665
@ -182,7 +182,7 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
// x, y := f() becomes BLOCK{CALL f, AS x [SP+0], AS y [SP+n]}
|
||||
// We don't want to instrument between the statements because it will
|
||||
// smash the results.
|
||||
racewalknode(&n->list->n, &n->ninit, 0, 0);
|
||||
racewalknode(&n->list->n, &n->list->n->ninit, 0, 0);
|
||||
fini = nil;
|
||||
racewalklist(n->list->next, &fini);
|
||||
n->list = concat(n->list, fini);
|
||||
|
@ -155,3 +155,18 @@ func runTests() ([]byte, error) {
|
||||
cmd.Env = append(cmd.Env, `GORACE="suppress_equal_stacks=0 suppress_equal_addresses=0 exitcode=0"`)
|
||||
return cmd.CombinedOutput()
|
||||
}
|
||||
|
||||
func TestIssue8102(t *testing.T) {
|
||||
// If this compiles with -race, the test passes.
|
||||
type S struct {
|
||||
x interface{}
|
||||
i int
|
||||
}
|
||||
c := make(chan int)
|
||||
a := [2]*int{}
|
||||
for ; ; c <- *a[S{}.i] {
|
||||
if t != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user