mirror of
https://github.com/golang/go
synced 2024-11-22 14:34:45 -07:00
cmd/gc: avoid creating circular lists when compiling with race detector.
Fixes #5431. R=dvyukov, remyoudompheng, rsc CC=gobot, golang-dev https://golang.org/cl/9910043
This commit is contained in:
parent
caefc5d0ca
commit
e7657de717
@ -255,7 +255,11 @@ racewalknode(Node **np, NodeList **init, int wr, int skip)
|
||||
// side effects are safe.
|
||||
// n->right may not be executed,
|
||||
// so instrumentation goes to n->right->ninit, not init.
|
||||
l = nil;
|
||||
// If right->ninit is non-nil, racewalknode might append it to itself.
|
||||
// nil it out and handle it separately before putting it back.
|
||||
l = n->right->ninit;
|
||||
n->right->ninit = nil;
|
||||
racewalklist(l, nil);
|
||||
racewalknode(&n->right, &l, wr, 0);
|
||||
appendinit(&n->right, l);
|
||||
goto ret;
|
||||
|
15
src/pkg/runtime/race/testdata/regression_test.go
vendored
15
src/pkg/runtime/race/testdata/regression_test.go
vendored
@ -160,3 +160,18 @@ func noRaceReturn(c chan int) (a, b int) {
|
||||
}()
|
||||
return a, 10
|
||||
}
|
||||
|
||||
func issue5431() {
|
||||
var p **inltype
|
||||
if inlinetest(p).x && inlinetest(p).y {
|
||||
} else if inlinetest(p).x || inlinetest(p).y {
|
||||
}
|
||||
}
|
||||
|
||||
type inltype struct {
|
||||
x, y bool
|
||||
}
|
||||
|
||||
func inlinetest(p **inltype) *inltype {
|
||||
return *p
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user