1
0
mirror of https://github.com/golang/go synced 2024-11-22 19:05:01 -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:
Daniel Morsing 2013-06-11 21:19:29 +02:00
parent caefc5d0ca
commit e7657de717
2 changed files with 20 additions and 1 deletions

View File

@ -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;

View File

@ -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
}